Skip to content

Commit f1193a3

Browse files
authored
feat: Blog posts (#6) (#8)
* Collection with directory filter * Check if collections exists in themeConfig * PostList as global-component * Sort PostList * simplify to just blog * Post formatted date and image
1 parent b51bcd9 commit f1193a3

File tree

18 files changed

+174
-61
lines changed

18 files changed

+174
-61
lines changed

example/.vuepress/config.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1+
const themeConfig = require('./themeConfig')
2+
13
module.exports = {
24
title: 'Example Website',
35
description: 'An example website built with vuepress-theme-base',
46
base: '/vuepress-theme-base/',
57
theme: require.resolve('../../theme'),
6-
themeConfig: {
7-
nav: [
8-
{ text: 'Docs', link: '/docs/' },
9-
{ text: 'Blog', link: '/blog/' },
10-
],
11-
defaultLayouts: [
12-
{
13-
directory: 'blog',
14-
layout: 'Post',
15-
},
16-
],
17-
},
8+
themeConfig,
189
}

example/.vuepress/themeConfig.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
nav: [
3+
{ text: 'Blog', link: '/blog/' },
4+
{ text: 'About', link: '/about/' },
5+
{ text: 'Contact', link: '/contact/' },
6+
],
7+
collections: [
8+
{
9+
directory: 'blog',
10+
layout: 'Post',
11+
},
12+
],
13+
}

example/about.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# About
2+
3+
Hello world!

example/blog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Blog
2+
3+
<PostList directory="blog" />

example/blog/a-newer-blog-post.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: A newer blog post
3+
date: 2020-06-17 19:57:13 UTC
4+
image: https://picsum.photos/400/400
5+
---
6+
7+
Lorem ipsum

example/blog/first-blog-post.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: First blog post
3+
date: 2020-04-15 17:57:13 UTC
4+
image: https://picsum.photos/450/450
5+
---
6+
7+
Lorem ipsum

example/blog/index.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

example/blog/post1.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/blog/second-blog-post.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Second blog post
3+
date: 2020-05-16 18:57:13 UTC
4+
image: https://picsum.photos/300/300
5+
---
6+
7+
Lorem ipsum

example/contact.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Contact us

0 commit comments

Comments
 (0)