This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/routes/blog.vue

41 lines
961 B
Vue

<template>
<NotFound v-if="!content"/>
<div v-else class="container blog-post">
<div v-html="content"></div>
</div>
</template>
<script>
import { head } from "../src/helpers";
export default {
async asyncData({route}) {
try {
const content = (await import(`../locale/pl/blog/${route.params.slug}.md`)).default;
const title = content.match('<h1[^>]*>([^<]+)</h1>')[1];
const img = content.match('<img src="([^"]+)"[^>]*>')[1];
return {
content,
title,
img,
}
} catch {
return {};
}
},
head() {
return head({
title: this.title,
banner: this.img,
});
},
};
</script>
<style lang="scss">
.blog-post img {
max-width: 100%;
}
</style>