Skip to content

Tag Feature #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions _includes/tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% for tag in page.tags %}
{% if tag != 'home' %}
{% capture tag_name %}{{ tag }}{% endcapture %}
<a href="/tag/#{{ tag_name }}" class="badge badge-pil"><code ><nobr>{{ tag_name }}</nobr></code></a>
{% endif %}
{% endfor %}
2 changes: 2 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ <h3 class="author__name" itemprop="name">{{ author_details.name }}</h3>

{{ content }}

{% include tags.html %}

<hr>

{% include social-share.html %}
Expand Down
8 changes: 8 additions & 0 deletions assets/custom/scss/_tags.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// for tags

.badge {
color: dimgrey;
padding: 10px;
font-family: "Courier New", Courier, monospace;
background-color: #e7e7e7;
}
1 change: 1 addition & 0 deletions assets/custom/scss/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
@import "social-share.scss";
@import "markdown.scss";
@import "pygments.scss";
@import "tags.scss";
70 changes: 70 additions & 0 deletions tag/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
layout: page
title: Tags
background: '/img/bg-post.jpg'
---
{% capture tags %}
{% for tag in site.tags %}
{{ tag[0] }}
{% endfor %}
{% endcapture %}
{% assign sortedtags = tags | split:' ' | sort %}

{% for tag in sortedtags %}
{% if tag != 'home' %}
<a href="/tag/#{{ tag }}" class="badge badge-pil"><code ><nobr>{{ tag }}</nobr></code></a>
{% endif %}
{% endfor %}
<br> <br>

{% for tag in sortedtags %}
{% if tag != 'home' %}
<h3><a href="/tag/#{{ tag }}" class="badge badge-pil" id="{{ tag }}"><code ><nobr>{{ tag }}</nobr></code></a></h3>
<ul>
{% for post in site.tags[tag] %}

<article class="post-preview">
<a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}">
<h2 class="post-title">{{ post.title }}</h2>
{% if post.subtitle %}
<h3 class="post-subtitle">{{ post.subtitle }}</h3>
{% else %}
<h3 class="post-subtitle">{{ post.excerpt | strip_html | truncatewords: 15 }}</h3>
{% endif %}
</a>

{% if post.author %}
{% assign authors = post.author %}
{% else %}
{% assign authors = site.author %}
{% endif %}

<p class="meta">Posted by
{% if authors.first %}
{% for author in authors %}
{% if post.author_url[forloop.index0] %}
<a target="_blank" href="{{ post.author_url[forloop.index0] }}">{{ author }}</a>{% unless forloop.last %},{% endunless %}
{% else %}
{{ author }}{% unless forloop.last %},{% endunless %}
{% endif %}
{% endfor %}
{% else %}
{% if post.author_url %}
<a target="_blank" href="{{ post.author_url }}">{{ authors }}</a>
{% else %}
{{ authors }}
{% endif %}
{% endif %}
on {{ post.date | date: '%B %d, %Y' }} &middot; {% include read_time.html content=post.content %} &middot;
<a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}#disqus_thread"></a>
</p>

</article>
<hr>


{% endfor %}
</ul>

{% endif %}
{% endfor %}