automatic markdwon page creation

This commit is contained in:
hamdy
2020-11-22 12:29:01 +02:00
parent 9d661b633f
commit d8ea099edf
3 changed files with 59 additions and 0 deletions

7
content/page/one.md Normal file
View File

@@ -0,0 +1,7 @@
---
id: one
title: One
---
# Hi

View File

@@ -55,6 +55,13 @@ module.exports = {
path: 'content/site/*.json' path: 'content/site/*.json'
} }
}, },
{
use: '@gridsome/source-filesystem',
options: {
typeName: 'MarkdownPage',
path: './content/page/**/*.md',
}
},
{ {
use: '@gridsome/source-filesystem', use: '@gridsome/source-filesystem',
options: { options: {
@@ -143,5 +150,9 @@ module.exports = {
path: '/project/:id', path: '/project/:id',
component: '~/templates/Project.vue' component: '~/templates/Project.vue'
}], }],
MarkdownPage: [{
path: '/page/:id',
component: '~/templates/MarkdownPage.vue'
}],
} }
} }

View File

@@ -0,0 +1,41 @@
<template>
<Layout :hideHeader="true" :disableScroll="true">
<div class="container sm:pxi-0 mx-auto overflow-x-hidden">
<vue-markdown>
{{ $page.markdownPage.content }}
</vue-markdown>
</div>
</Layout>
</template>
<page-query>
query($id: ID!) {
markdownPage(id: $id) {
path
content
title
}
}
</page-query>
<script>
import VueMarkdown from 'vue-markdown'
export default {
components: {
VueMarkdown
},
metaInfo() {
return {
title: this.$page.markdownPage.title,
};
},
};
</script>
<style scoped>
/* h2 {
padding-bottom: 8rem;
} */
</style> >