From fe18e105e099c9055c7e0b22c676ba32a1f0e794 Mon Sep 17 00:00:00 2001 From: Tommy Vedvik Date: Wed, 27 Feb 2019 14:05:53 +0100 Subject: [PATCH] Added tag support --- content/posts/markdown-test-file.md | 1 + content/posts/say-hello-to-gridsome.md | 1 + gridsome.config.js | 10 ++++- src/assets/style/_typography.scss | 4 -- src/assets/style/_utils.scss | 7 ++++ src/assets/style/index.scss | 1 + src/components/PostCard.vue | 24 +++++++++-- src/layouts/Default.vue | 6 ++- src/pages/Index.vue | 2 +- src/templates/Tag.vue | 55 ++++++++++++++++++++++++++ 10 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 src/assets/style/_utils.scss create mode 100644 src/templates/Tag.vue diff --git a/content/posts/markdown-test-file.md b/content/posts/markdown-test-file.md index f9e7169..4821423 100644 --- a/content/posts/markdown-test-file.md +++ b/content/posts/markdown-test-file.md @@ -1,6 +1,7 @@ --- title: Markdown test files date: 2019-02-06 +tags: ['Markdown'] excerpt: "Markdown is intended to be as easy-to-read and easy-to-write as is feasible. Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions." --- diff --git a/content/posts/say-hello-to-gridsome.md b/content/posts/say-hello-to-gridsome.md index 8095c23..c50039c 100644 --- a/content/posts/say-hello-to-gridsome.md +++ b/content/posts/say-hello-to-gridsome.md @@ -1,6 +1,7 @@ --- title: Say hello to Gridsome 🎉 date: 2019-02-07 +tags: ['Markdown', 'Releases'] excerpt: "A new static site generator baby is born. It's highly inspired by Gatsby.js (React based) but built on top of Vue.js. We have been working on it for a year and will have a beta ready soon. You can expect this baby to grow up fast!" --- diff --git a/gridsome.config.js b/gridsome.config.js index 796bd5d..794622a 100644 --- a/gridsome.config.js +++ b/gridsome.config.js @@ -24,7 +24,15 @@ module.exports = { options: { path: 'content/posts/*.md', typeName: 'Post', - route: '/:slug' + route: '/:slug', + refs: { + // Creates tags from 'tags' in Markdown files + tags: { + typeName: 'Tag', + route: '/tag/:id', + create: true + } + } } } ] diff --git a/src/assets/style/_typography.scss b/src/assets/style/_typography.scss index 8b73c6c..b29a8b4 100644 --- a/src/assets/style/_typography.scss +++ b/src/assets/style/_typography.scss @@ -19,10 +19,6 @@ h1, h2, h3, h4, h5 { font-family: 'Poppins', sans-serif; font-weight: 600; line-height: 1.15; - - &:first-child { - margin-top: 0; - } } h1 { diff --git a/src/assets/style/_utils.scss b/src/assets/style/_utils.scss new file mode 100644 index 0000000..e06499e --- /dev/null +++ b/src/assets/style/_utils.scss @@ -0,0 +1,7 @@ +.text-center { + text-align: center; +} + +.space-bottom { + margin-bottom: var(--space); +} \ No newline at end of file diff --git a/src/assets/style/index.scss b/src/assets/style/index.scss index b2d6961..60f7495 100644 --- a/src/assets/style/index.scss +++ b/src/assets/style/index.scss @@ -4,3 +4,4 @@ @import 'base'; @import 'code'; @import 'content-box'; +@import 'utils'; \ No newline at end of file diff --git a/src/components/PostCard.vue b/src/components/PostCard.vue index bdd91ec..ad8eeb8 100644 --- a/src/components/PostCard.vue +++ b/src/components/PostCard.vue @@ -1,8 +1,11 @@ @@ -22,6 +25,21 @@ export default { margin-bottom: var(--space); position: relative; + &__header { + width: calc(100% + var(--space) * 2); + margin-left: calc(var(--space) * -1); + margin-top: calc(var(--space) * -1); + margin-bottom: calc(var(--space) / 2); + + &:empty { + display: none; + } + } + + &__title { + margin-top: 0; + } + &:hover { transform: translateY(-5px); box-shadow: 1px 10px 30px 0 rgba(0,0,0,.1); diff --git a/src/layouts/Default.vue b/src/layouts/Default.vue index 0b71283..436c6cb 100644 --- a/src/layouts/Default.vue +++ b/src/layouts/Default.vue @@ -3,7 +3,8 @@
-