Skip to content

Commit

Permalink
feat(website): 🌱 Add tags page with counts
Browse files Browse the repository at this point in the history
  • Loading branch information
avimehenwal committed Jul 12, 2020
1 parent 4ca4a07 commit ba35e5e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 7 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# python.avimehenwal

[![Netlify Status](https://api.netlify.com/api/v1/badges/afbd0131-1f02-469f-a138-844511ca6420/deploy-status)](https://app.netlify.com/sites/avi-python/deploys)

# :snake: python.avimehenwal

> python practise repo
Link to Project [docs]
:earth_asia: Live Link to Project [docs]

![List Page on mobile](demo/mobile-listpage.png)

![Homepage with logo](/demo/homepage-with-logo.png)

---

#### Get in touch with me
#### :v: Get in touch with me

> I am looking for Jobs ... :sunglasses:
Expand All @@ -25,7 +26,4 @@ Link to Project [docs]

<a href="https://www.buymeacoffee.com/F1j07cV" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>

Spread Love :hearts: and not :no_entry_sign: hatred [![Twitter Follow](https://img.shields.io/twitter/follow/avimehenwal.svg?style=social)](https://twitter.com/avimehenwal)


[docs]: https://avi-python.netlify.app/
Spread Love :hearts: and not :no_entry_sign: hatred [![Twitter Follow](https://img.shields.io/twitter/follow/avimehenwal.svg?style=social)](https://twitter.com/avimehenwal)
60 changes: 60 additions & 0 deletions docs/.vuepress/components/TagList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!-- .vuepress/components/TagList.vue -->
<template lang="html">
<div>
<h1>
Tags <Badge type="error" :text="tagcount"/>
</h1>

<span v-for="tag in Object.keys(tags)">
<h2 :id="tag">
<router-link
:to="{ path: `/tags.html/#${tag}`}"
class="header-anchor"
aria-hidden="true"
>
#
</router-link>
<Badge vertical="middle" type="tip" :text="tag"/>
<Badge type="error" :text="tags[tag].length"/>
<!-- <Badge type="warning" :text="tags[tag].length"/> -->
</h2>

<ul class="w3-ul w3-hoverable">
<li v-for="page in tags[tag]">
<router-link :to="{ path: page.path}">
{{page.title}}
</router-link>
</li>
</ul>
</span>
</div>
</template>

<script>
export default {
// data () {
// return {
// dtags: this.tags[tag]
// }
// },
computed: {
tags() {
let tags = {}
for (let page of this.$site.pages) {
for (let index in page.frontmatter.tags) {
const tag = page.frontmatter.tags[index]
if (tag in tags) {
tags[tag].push(page)
} else {
tags[tag] = [page]
}
}
}
return tags
},
tagcount () {
return Object.keys(this.tags).length;
}
}
}
</script>
1 change: 1 addition & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
smoothScroll: true,
nav: [
{ text: 'Home', link: '/' },
{ text: 'Tags', link: '/tags' },
{ text: 'Tutorials', link: '/tutorials/' },
{ text: 'Projects', link: '/projects/' }
]
Expand Down
1 change: 1 addition & 0 deletions docs/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<TagList />

0 comments on commit ba35e5e

Please sign in to comment.