about summary refs log tree commit diff
path: root/pages/kronika
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-12 15:40:51 +0200
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-10-12 15:40:51 +0200
commitd92f1a2a1bac3039434a16c504cc1d54c6d0409a (patch)
treec0c5b9d4539512b44a4c99a114d3ef523cc92e73 /pages/kronika
parent7a17a28220a84c294728f572932b1619d92c1d95 (diff)
downloadpuszcza-d92f1a2a1bac3039434a16c504cc1d54c6d0409a.tar.gz
puszcza-d92f1a2a1bac3039434a16c504cc1d54c6d0409a.zip
Change posts location
Diffstat (limited to 'pages/kronika')
-rw-r--r--pages/kronika/_year/_month/_day/_title/index.vue65
1 files changed, 65 insertions, 0 deletions
diff --git a/pages/kronika/_year/_month/_day/_title/index.vue b/pages/kronika/_year/_month/_day/_title/index.vue
new file mode 100644
index 0000000..1148f61
--- /dev/null
+++ b/pages/kronika/_year/_month/_day/_title/index.vue
@@ -0,0 +1,65 @@
+<template>
+  <div>
+    <div v-if="notFound">
+      <h1>404</h1>
+      <p>Nie znaleziono wpisu</p>
+    </div>
+    <div v-else class="article">
+      <!-- <h1>{{ params.title }}</h1>
+      <span>{{ `${params.year}-${params.month}-${params.day}` }}</span>-->
+      <div class="content" v-html="content"></div>
+    </div>
+  </div>
+</template>
+
+<script>
+const md = require('markdown-it')()
+import frontmatter from 'front-matter'
+
+export default {
+  async asyncData({ params }) {
+    console.log(params)
+    const fileContent = await import(
+      `~/content/wpisy/${params.year}/${params.month}/${
+        params.day
+      }/${params.title.toLowerCase()}.md`
+    ).catch(e => console.log(e))
+
+    if (fileContent === undefined) return { notFound: true }
+
+    let post = frontmatter(fileContent.default)
+    console.log(post.attributes)
+    return {
+      params,
+      attributes: post.attributes,
+      content: md.render(post.body)
+    }
+  },
+  data() {
+    return {
+      notFound: false
+    }
+  }
+}
+</script>
+
+<style>
+.article {
+  padding: 20px 80px 20px 80px;
+  width: 100%;
+  max-width: 1000px;
+  flex: 1;
+  background: #ffffff;
+  box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.25);
+  z-index: -1;
+}
+.article img {
+  width: 100%;
+  border-radius: 5px;
+}
+@media (max-width: 720px) {
+  .article {
+    padding: 20px 40px 20px 40px;
+  }
+}
+</style>
\ No newline at end of file