automatic markdwon page creation
This commit is contained in:
7
content/page/one.md
Normal file
7
content/page/one.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
id: one
|
||||||
|
title: One
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
# Hi
|
||||||
@@ -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'
|
||||||
|
}],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
41
src/templates/MarkdownPage.vue
Normal file
41
src/templates/MarkdownPage.vue
Normal 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> >
|
||||||
Reference in New Issue
Block a user