Skip to content

Commit

Permalink
Search By Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
MiteshShah committed Apr 19, 2016
1 parent 6abd9ea commit 304b147
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
5 changes: 5 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ <h1><a href="{{ page.link }}">{{ page.title }}</a></h1>
{% else %}
<h1><a href="{{ site.url }}{{ page.url }}" rel="bookmark" title="{{ page.title }}">{{ page.title }}</a></h1>
{% endif %}
<ul class="taglist">
{% for tag in page.tags %}
<li class="tag"><a href="/tag/#{{ page.category }}{{ tag | downcase }}">{{ tag }}</a></li>
{% endfor %}
</ul>
{% include _reading-time.html %}
</div><!--/ .headline-wrap -->
<div class="article-wrap">
Expand Down
26 changes: 26 additions & 0 deletions _sass/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -880,3 +880,29 @@ $button-size: 1.5rem;
#goog-wm-sb {
@extend .btn;
}

ul.taglist {
list-style-type: none;
padding: 0
}

ul.taglist li.tag:before {
content: '#'
}

ul.taglist li.tag {
display: inline;
font-size: 75%;
color: #505050;
background-color: #FFFF99;
padding: 0.2em 0.6em;
border-radius: 0.8em
}

ul.taglist li.tag a {
color: inherit
}

.tag { background-color:#EEE; color:#333; display:inline; padding:4px; }
#tagcloud { font-size:.9em; }
.tags li { display:inline; padding:0 4px; background:#EEE;}
39 changes: 39 additions & 0 deletions tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
layout: page
title: Search By Tags
permalink: /tag/

sitemap:
priority: .5

---

Click on a tag to see relevant list of posts.

<ul class="taglist">
{% for tag in site.tags %}
{% assign t = tag | first %}
<li class="tag"><a href="/tag/#{{t | downcase | replace:" ","-" }}">{{ t | downcase }}</a></li>
{% endfor %}
</ul>

---

{% for tag in site.tags %}
{% assign t = tag | first %}
{% assign posts = tag | last %}

<h4><a name="{{t | downcase | replace:" ","-" }}"></a><a class="internal" href="/tag/#{{t | downcase | replace:" ","-" }}">{{ t | downcase }}</a></h4>
<ul>
{% for post in posts %}
{% if post.tags contains t %}
<li>
<a href="{{ post.url }}">{{ post.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>

---

{% endfor %}

0 comments on commit 304b147

Please sign in to comment.