about summary refs log tree commit diff
path: root/pages/kronika/_year
diff options
context:
space:
mode:
Diffstat (limited to 'pages/kronika/_year')
-rw-r--r--pages/kronika/_year/_month/_day/_title/index.vue17
1 files changed, 11 insertions, 6 deletions
diff --git a/pages/kronika/_year/_month/_day/_title/index.vue b/pages/kronika/_year/_month/_day/_title/index.vue
index 750b498..f6169b2 100644
--- a/pages/kronika/_year/_month/_day/_title/index.vue
+++ b/pages/kronika/_year/_month/_day/_title/index.vue
@@ -15,19 +15,24 @@
 <script>
 const md = require('markdown-it')()
 import frontmatter from 'front-matter'
-import k from '~/api'
+import { getPostAttributes } from '~/api/api'
 
 export default {
   async asyncData({ params }) {
-    const { year, month, day, title } = params
-    const post = k.getPost(year, month, day, title)
+    const fileContent = await import(
+      `~/content/wpisy/${params.year}/${params.month}/${
+        params.day
+      }/${params.title.toLowerCase()}.md`
+    ).catch(e => console.log(e))
 
-    if (post === undefined) return { notFound: true }
+    if (fileContent === undefined) return { notFound: true }
+
+    const post = getPostAttributes(fileContent.default)
 
     return {
       params,
-      attributes: post.content.meta,
-      content: post.content.html
+      attributes: post.attributes,
+      content: post.body
     }
   },
   data() {