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
|
||||
date: 2019-01-07
|
||||
published: true
|
||||
tags: ['Markdown']
|
||||
tags: ['Markdown', 'Cover Image']
|
||||
series: false
|
||||
cover_image: ./images/alexandr-podvalny-220262-unsplash.jpg
|
||||
canonical_url: false
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: Markdown test files
|
||||
date: 2019-02-06
|
||||
published: true
|
||||
tags: ['Markdown']
|
||||
tags: ['Markdown','Test files']
|
||||
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."
|
||||
---
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
<div class="post-card__content">
|
||||
<h2 class="post-card__title" v-html="post.title" />
|
||||
<p class="post-card__description" v-html="post.description" />
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -14,9 +17,12 @@
|
|||
|
||||
<script>
|
||||
import PostMeta from '~/components/PostMeta'
|
||||
import PostTags from '~/components/PostTags'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PostMeta
|
||||
PostMeta,
|
||||
PostTags
|
||||
},
|
||||
props: ['post'],
|
||||
}
|
||||
|
@ -53,6 +59,11 @@ export default {
|
|||
box-shadow: 1px 10px 30px 0 rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
&__tags {
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__link {
|
||||
position: absolute;
|
||||
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
|
||||
title
|
||||
path
|
||||
tags {
|
||||
id
|
||||
title
|
||||
path
|
||||
}
|
||||
date (format: "D. MMMM YYYY")
|
||||
timeToRead
|
||||
description
|
||||
coverImage (width: 770, height: 380, blur: 10)
|
||||
...on Post {
|
||||
id
|
||||
title
|
||||
path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,15 +6,18 @@
|
|||
</h1>
|
||||
|
||||
<PostMeta :post="$page.post" />
|
||||
|
||||
</div>
|
||||
|
||||
<div class="post content-box">
|
||||
<div class="post__header">
|
||||
<g-image v-if="$page.post.coverImage" :src="$page.post.coverImage" />
|
||||
</div>
|
||||
|
||||
<div class="post__content" v-html="$page.post.content" />
|
||||
|
||||
<div class="post__footer">
|
||||
<!-- Add anything here -->
|
||||
<PostTags :post="$page.post" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -28,12 +31,14 @@
|
|||
|
||||
<script>
|
||||
import PostMeta from '~/components/PostMeta'
|
||||
import PostTags from '~/components/PostTags'
|
||||
import Author from '~/components/Author.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Author,
|
||||
PostMeta
|
||||
PostMeta,
|
||||
PostTags
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -45,6 +50,11 @@ query Post ($path: String!) {
|
|||
path
|
||||
date (format: "D. MMMM YYYY")
|
||||
timeToRead
|
||||
tags {
|
||||
id
|
||||
title
|
||||
path
|
||||
}
|
||||
description
|
||||
content
|
||||
coverImage (width: 860, blur: 10)
|
||||
|
|
Loading…
Add table
Reference in a new issue