Skip to content

Commit

Permalink
Add tags to post (issue #39)
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahAlhumud committed Aug 5, 2017
1 parent 426fd90 commit 3f9cc0f
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 2 deletions.
9 changes: 9 additions & 0 deletions _includes/css/screen.css
Expand Up @@ -120,6 +120,15 @@ nav h1, nav h2 {
font-size: 13px;
}

#tags {
margin-top: 80px;
margin-bottom: 50px;
font-size: 13px;
padding-top: 15px ;
border-top: dotted #ddd;
border-width: 1px 0;
}

#post pre {
border: 1px solid #ddd;
background-color: #eef;
Expand Down
4 changes: 4 additions & 0 deletions _includes/sidebar.html
Expand Up @@ -17,4 +17,8 @@ <h2>I'm <a href="/">{{ site.data.theme.name }}</a>.</h2>
<div id="social">
{% include social.html %}
</div>

<div id="tags">
{% include tags.html %}
</div>
</nav>
15 changes: 15 additions & 0 deletions _includes/tags.html
@@ -0,0 +1,15 @@
<span >
{% assign sorted_tags = site.tags | sort %}

{% for tag in sorted_tags %}
<a href="{{ '/tag/' | append:tag[0] }}.html" rel="tag">
{{tag[0]}}
{% if forloop.last %}
.
{% else %}
,
{% endif %}
</a>
{% endfor %}

</span>
19 changes: 17 additions & 2 deletions _layouts/post.html
@@ -1,9 +1,9 @@
---
---
layout: default
---

<p class="meta">
{{ page.date | date: "%B %d, %Y" }}
{{ page.date | date: "%B %d, %Y" }}
<a href="/">
<i class="home fa fa-home"></i>
</a>
Expand All @@ -24,4 +24,19 @@ <h3>Related Posts</h3>
</li>
{% endfor %}
</ul>

<h3>Tags :</h3>
<span>
{% for tag in page.tags %}
<a href="{{ '/tag/' | append:tag }}.html" rel="tag">
{{ tag }}
{% if forloop.last %}
.
{% else %}
,
{% endif %}
</a>
{% unless forloop.last %}{% endunless %}{% endfor %}
</span>
</div>

20 changes: 20 additions & 0 deletions _layouts/tag.html
@@ -0,0 +1,20 @@
---
layout: default
---

{% capture tag %}{{ page.title | slugify }}{% endcapture %}


<div id="home">
<h2><i class="fa fa-bookmark"></i> {{ tag | capitalize }} Posts </h2>
<ul id="blog-posts" class="posts">
{% for post in site.posts %}
{% if post.tags contains tag %}
<li><span>{{ post.date | date_to_string }} &raquo;</span>
<a href="{{ post.url }}">{{ post.title }}</a>
</li>
{% endif %}
{% endfor %}

</ul>
</div>
1 change: 1 addition & 0 deletions _posts/2013-08-12-another-sample.md
@@ -1,6 +1,7 @@
---
layout: post
title: Another sample
tags: [jekyll, syntax]
categories:
- blog
---
Expand Down
1 change: 1 addition & 0 deletions _posts/2013-08-20-sample-post.md
@@ -1,6 +1,7 @@
---
layout: post
title: Sample post
tags: [code, jekyll]
categories:
- blog
---
Expand Down
4 changes: 4 additions & 0 deletions tag/code.md
@@ -0,0 +1,4 @@
---
layout: tag
title: code
---
4 changes: 4 additions & 0 deletions tag/jekyll.md
@@ -0,0 +1,4 @@
---
layout: tag
title: jekyll
---
4 changes: 4 additions & 0 deletions tag/syntax.md
@@ -0,0 +1,4 @@
---
layout: tag
title: syntax
---

0 comments on commit 3f9cc0f

Please sign in to comment.