Add tags links
This commit is contained in:
parent
72cb2f5c11
commit
ac03309095
6 changed files with 65 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
||||||
title: A post with a cover image
|
title: A post with a cover image
|
||||||
date: 2019-01-07
|
date: 2019-01-07
|
||||||
published: true
|
published: true
|
||||||
tags: ['Markdown']
|
tags: ['Markdown', 'Cover Image']
|
||||||
series: false
|
series: false
|
||||||
cover_image: ./images/alexandr-podvalny-220262-unsplash.jpg
|
cover_image: ./images/alexandr-podvalny-220262-unsplash.jpg
|
||||||
canonical_url: false
|
canonical_url: false
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
title: Markdown test files
|
title: Markdown test files
|
||||||
date: 2019-02-06
|
date: 2019-02-06
|
||||||
published: true
|
published: true
|
||||||
tags: ['Markdown']
|
tags: ['Markdown','Test files']
|
||||||
canonical_url: false
|
canonical_url: false
|
||||||
description: "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."
|
description: "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."
|
||||||
---
|
---
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
<div class="post-card__content">
|
<div class="post-card__content">
|
||||||
<h2 class="post-card__title" v-html="post.title" />
|
<h2 class="post-card__title" v-html="post.title" />
|
||||||
<p class="post-card__description" v-html="post.description" />
|
<p class="post-card__description" v-html="post.description" />
|
||||||
|
|
||||||
<PostMeta class="post-card__meta" :post="post" />
|
<PostMeta class="post-card__meta" :post="post" />
|
||||||
|
<PostTags class="post-card__tags" :post="post" />
|
||||||
|
|
||||||
<g-link class="post-card__link" :to="post.path">Link</g-link>
|
<g-link class="post-card__link" :to="post.path">Link</g-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,9 +17,12 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PostMeta from '~/components/PostMeta'
|
import PostMeta from '~/components/PostMeta'
|
||||||
|
import PostTags from '~/components/PostTags'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
PostMeta
|
PostMeta,
|
||||||
|
PostTags
|
||||||
},
|
},
|
||||||
props: ['post'],
|
props: ['post'],
|
||||||
}
|
}
|
||||||
|
@ -53,6 +59,11 @@ export default {
|
||||||
box-shadow: 1px 10px 30px 0 rgba(0,0,0,.1);
|
box-shadow: 1px 10px 30px 0 rgba(0,0,0,.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__tags {
|
||||||
|
z-index: 1;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
&__link {
|
&__link {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
29
src/components/PostTags.vue
Normal file
29
src/components/PostTags.vue
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<template>
|
||||||
|
<div class="post-tags">
|
||||||
|
<g-link class="post-tags__link" v-for="tag in post.tags" :key="tag.id" :to="tag.path">
|
||||||
|
<span>#</span> {{ tag.title }}
|
||||||
|
</g-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: ['post']
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.post-tags {
|
||||||
|
margin: 1em 0 0;
|
||||||
|
|
||||||
|
&__link {
|
||||||
|
margin-right: 1em;
|
||||||
|
font-size: .8rem;
|
||||||
|
color: currentColor;
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
padding: .5em;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -27,10 +27,20 @@ query {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
path
|
path
|
||||||
|
tags {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
path
|
||||||
|
}
|
||||||
date (format: "D. MMMM YYYY")
|
date (format: "D. MMMM YYYY")
|
||||||
timeToRead
|
timeToRead
|
||||||
description
|
description
|
||||||
coverImage (width: 770, height: 380, blur: 10)
|
coverImage (width: 770, height: 380, blur: 10)
|
||||||
|
...on Post {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
path
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,18 @@
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<PostMeta :post="$page.post" />
|
<PostMeta :post="$page.post" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="post content-box">
|
<div class="post content-box">
|
||||||
<div class="post__header">
|
<div class="post__header">
|
||||||
<g-image v-if="$page.post.coverImage" :src="$page.post.coverImage" />
|
<g-image v-if="$page.post.coverImage" :src="$page.post.coverImage" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="post__content" v-html="$page.post.content" />
|
<div class="post__content" v-html="$page.post.content" />
|
||||||
|
|
||||||
<div class="post__footer">
|
<div class="post__footer">
|
||||||
<!-- Add anything here -->
|
<PostTags :post="$page.post" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -28,12 +31,14 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PostMeta from '~/components/PostMeta'
|
import PostMeta from '~/components/PostMeta'
|
||||||
|
import PostTags from '~/components/PostTags'
|
||||||
import Author from '~/components/Author.vue'
|
import Author from '~/components/Author.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Author,
|
Author,
|
||||||
PostMeta
|
PostMeta,
|
||||||
|
PostTags
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -45,6 +50,11 @@ query Post ($path: String!) {
|
||||||
path
|
path
|
||||||
date (format: "D. MMMM YYYY")
|
date (format: "D. MMMM YYYY")
|
||||||
timeToRead
|
timeToRead
|
||||||
|
tags {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
path
|
||||||
|
}
|
||||||
description
|
description
|
||||||
content
|
content
|
||||||
coverImage (width: 860, blur: 10)
|
coverImage (width: 860, blur: 10)
|
||||||
|
|
Loading…
Add table
Reference in a new issue