Working blog, I think!

merge-requests/2/head
Matthew Ess 2018-10-18 02:19:46 -04:00
parent 2f9f7bc259
commit 1493a0dd41
12 changed files with 42 additions and 49 deletions

1
.gitignore vendored
View File

@ -69,6 +69,7 @@ typings/
.nuxt .nuxt
# Nuxt generate # Nuxt generate
public
dist dist
# vuepress build output # vuepress build output

View File

@ -18,9 +18,9 @@ export default {
props: { props: {
compact: { compact: {
type: Boolean, type: Boolean,
default: false default: false,
} },
} },
} }
</script> </script>

View File

@ -1,15 +0,0 @@
---
title: writing your own blog in Vue, powered by Nuxt, and Nuxtent
tagline: break free from boring jekyll themes
tags:
- blog
- vue
- vuejs
- nuxt
- nuxtent
- markdown
- static site
- github pages
- gitlab pages
draft: true
---

View File

@ -10,7 +10,7 @@
import hero from '../components/hero.vue' import hero from '../components/hero.vue'
export default { export default {
components: { hero } components: { hero },
} }
</script> </script>

View File

@ -10,7 +10,7 @@
import hero from '../components/hero.vue' import hero from '../components/hero.vue'
export default { export default {
components: { hero } components: { hero },
} }
</script> </script>

View File

@ -14,8 +14,8 @@ export default {
{ charset: 'utf-8' }, { charset: 'utf-8' },
{ 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' }, { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description } { hid: 'description', name: 'description', content: pkg.description },
] ],
}, },
/* /*
@ -42,7 +42,7 @@ export default {
** Static Site Generation configuration ** Static Site Generation configuration
*/ */
generate: { generate: {
dir: 'public' dir: 'public',
}, },
/* /*
@ -50,10 +50,16 @@ export default {
*/ */
nuxtent: { nuxtent: {
content: { content: {
page: '/blog/_slug', page: '/_slug',
permalink: ':slug', permalink: '/blog/:slug',
generate: ['get', 'getAll'] isPost: false,
} generate: ['get', 'getAll'],
},
api: isStatic => {
return {
browserBaseURL: isStatic ? 'https://mat.services' : '',
}
},
}, },
/* /*
@ -63,9 +69,9 @@ export default {
postcss: { postcss: {
preset: { preset: {
features: { features: {
customProperties: false customProperties: false,
} },
} },
}, },
/* /*
** You can extend webpack config here ** You can extend webpack config here
@ -77,9 +83,9 @@ export default {
enforce: 'pre', enforce: 'pre',
test: /\.(js|vue)$/, test: /\.(js|vue)$/,
loader: 'eslint-loader', loader: 'eslint-loader',
exclude: /(node_modules)/ exclude: /(node_modules)/,
}) })
} }
} },
} },
} }

View File

@ -8,15 +8,10 @@
<script> <script>
export default { export default {
async asyncData({ app }) {
return {
listing: await app.$content('/').getAll()
}
},
head() { head() {
return { title: 'blog' } return { title: 'blog' }
}, },
layout: 'compact' layout: 'compact',
} }
</script> </script>

View File

@ -10,9 +10,9 @@
<script> <script>
export default { export default {
async asyncData({ app, params, payload }) { async asyncData({ app, route, payload }) {
return { return {
post: await app.$content('/').get(params.slug), post: (await app.$content('/').get(route.path)) || payload,
} }
}, },
head() { head() {

View File

@ -5,20 +5,26 @@ ul.blog-items
span.post-title {{ post.title }} span.post-title {{ post.title }}
span.post-date {{ post.date | prettifyDate }} span.post-date {{ post.date | prettifyDate }}
.post-tagline {{ post.tagline }} .post-tagline {{ post.tagline }}
hr(v-if='index < listing.length - 1') hr(v-if='last(index)')
</template> </template>
<script> <script>
export default { export default {
async asyncData({ app }) { async asyncData({ app }) {
return { return {
listing: await app listing:
.$content('/') (await app
.query({ exclude: ['body', 'meta', 'permalink', 'anchors'] }) .$content('/')
.getAll() .query({ exclude: ['body', 'meta', 'permalink', 'anchors'] })
.getAll()) || payload,
} }
}, },
layout: 'compact' methods: {
last(index) {
return index < this.listing.length - 1
},
},
layout: 'compact',
} }
</script> </script>

View File

@ -38,7 +38,7 @@ export default {
head() { head() {
return { title: 'projects' } return { title: 'projects' }
}, },
layout: 'compact' layout: 'compact',
} }
</script> </script>

View File

@ -49,7 +49,7 @@ export default {
head() { head() {
return { title: 'resume' } return { title: 'resume' }
}, },
layout: 'compact' layout: 'compact',
} }
</script> </script>