Skip to content

Commit

Permalink
feat: support tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Sep 17, 2018
1 parent 2095794 commit 0d4e46f
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
36 changes: 36 additions & 0 deletions layouts/Tag.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div>
<Header/>
<div class="main">
<div class="post-list">
<div class="post-item" v-for="post in $tag.posts" :key="post.key">
<h2 class="post-title">
<router-link :to="post.path">
{{ post.title }}
</router-link>
</h2>
</div>
</div>
</div>
<Footer/>
</div>
</template>

<script>
import Header from '@theme/components/Header'
import Footer from '@theme/components/Footer'
export default {
components: {
Header,
Footer
}
}
</script>

<style lang="stylus">
a {
font-weight 300;
text-decoration: none;
}
</style>
62 changes: 62 additions & 0 deletions layouts/Tags.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<div>
<Header/>
<div class="main">
<div class="tag-list">
<div class="tag-item" v-for="tag in $tags.tags" :key="tag.name">
<div class="tag-title">
<router-link :to="tag.path">
{{ tag.name }} ({{ tag.posts.length }})
</router-link>
</div>
</div>
</div>
</div>
<Footer/>
</div>
</template>

<script>
import Header from '@theme/components/Header'
import Footer from '@theme/components/Footer'
export default {
components: {
Header,
Footer
}
}
</script>

<style lang="stylus">
.tag-list
width 70%
&::after
display: block;
content: "";
clear: both;
.tag-item
font-size 25px
font-weight: 300
text-align left
box-sizing border-box
width: 33.333%;
float: left;
transition: background-color .3s;
a
color #b58900
text-decoration none
&:hover
a
color: #ff69b4 !important
@media screen and (max-width: 1000px)
.tag-item
width: 50%;
font-size 20px
@media screen and (max-width: 768px)
.tag-item
width: 100%;
font-size 20px
</style>

0 comments on commit 0d4e46f

Please # to comment.