diff --git a/_layouts/post.html b/_layouts/post.html index ae3d574c5844cd6eb125a0accdb172e4fd3ad99a..2b704e7579b50e55a1a05327da1b0a22c14b1625 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -3,9 +3,11 @@ layout: default --- <h1>{{ page.title }}</h1> <span class="time">{{ page.date | date_to_string }}</span> +{% if page.categories %} <span class="categories"> - » {% for category in page.categories %}{{ category }}{% if forloop.last == false %}, {% endif %}{% endfor %} + » {% for category in page.categories %}<a href="/category/{{ category }}">{{ category }}</a>{% if forloop.last == false %}, {% endif %}{% endfor %} </span> +{% endif %} <div class="content"> <div class="post">{{ content }}</div> @@ -23,11 +25,10 @@ layout: default <ul> {% endif %} <li class="relatedPost"> - <a href="{{ site.url }}{{ post.url }}">{{ post.title }} + <a href="{{ site.url }}{{ post.url }}">{{ post.title }}</a> {% if post.categories %} - (Categories: {{ post.categories | join: ', ' }}) + (Categories: {% for category in post.categories %}<a href="/category/{{ category }}">{{ category }}</a>{% if forloop.last == false %}, {% endif %}{% endfor %}) {% endif %} - </a> </li> {% capture hasSimilar %}{{ hasSimilar }}*{% endcapture %} {% assign postHasSimilar = true %} diff --git a/_layouts/posts_by_category.html b/_layouts/posts_by_category.html new file mode 100644 index 0000000000000000000000000000000000000000..685d7ca96403b90f4077230915e2e65265cc6289 --- /dev/null +++ b/_layouts/posts_by_category.html @@ -0,0 +1,49 @@ +--- +layout: default +--- + +<header id="post-header"> + <h1 id="post-subtitle">Articles by category: {{ page.categories }}</h1> +</header> + +<div id="post-content"> + <hr /> + {% for category in site.categories %} + {% capture category_slug %}{{ category | first }}{% endcapture %} + {% for c_slug in category_slug %} + {% if c_slug == page.categories %} + <button class="btn btn-sm btn-default active">{{ c_slug }}</button> + {% else %} + <a href="/category/{{ c_slug }}" class="btn btn-sm btn-default">{{ c_slug }}</a> + {% endif %} + {% endfor %} + {% endfor %} + <hr /> + + {% if site.categories[page.categories] %} + {% for post in site.categories[page.categories] %} + {% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %} + {% if forloop.first %} + <h4>{{ post_year }}</h4><div class="list-group"> + {% endif %} + + {% if forloop.first == false %} + {% assign previous_index = forloop.index0 | minus: 1 %} + {% capture previous_post_year %}{{ site.categories[page.categories][previous_index].date | date: '%Y' }}{% endcapture %} + {% if post_year != previous_post_year %} + </div><h4>{{ post_year }}</h4><div class="list-group"> + {% endif %} + {% endif %} + + <ol class="posts"> + <li><a href="{{ post.url }}">{{ post.title }}</a> » <i><span>{{ post.date | date_to_string }}</span></i></li> + </ol> + + {% if forloop.last %} + </div> + {% endif %} + {% endfor %} + {% else %} + <p>There are no posts in this categories.</p> + {% endif %} +</div> \ No newline at end of file diff --git a/_posts/2013-12-23-welcome-to-simply-grey.markdown b/_posts/2013-12-23-welcome-to-simply-grey.markdown index 1d4ed27ab7a5d5c606d01d79679b5839f0be1375..222bda232bc4ed2e47fd75a0cd21b6da27efb500 100644 --- a/_posts/2013-12-23-welcome-to-simply-grey.markdown +++ b/_posts/2013-12-23-welcome-to-simply-grey.markdown @@ -2,7 +2,7 @@ layout: post title: "Welcome to Simply Grey" date: 2013-12-23 00:18:23 +0700 -categories: [simplygrey] +categories: [jekyll] --- SimplyGrey is a simple, easy to use theme for Jekyll that compromises of mainly grey colours. A lot of people enjoy the simplistic look of grey and also find it easier to read. diff --git a/_posts/2016-04-19-welcome-to-jekyll.markdown b/_posts/2016-04-19-welcome-to-jekyll.markdown index 2e057b4a5408c1f6896ab35342b4c2f2e855e0d9..61fca6ed7b1e2e1df98c339b432e7798eb42b1d1 100644 --- a/_posts/2016-04-19-welcome-to-jekyll.markdown +++ b/_posts/2016-04-19-welcome-to-jekyll.markdown @@ -2,7 +2,7 @@ layout: post title: "Welcome to Jekyll!" date: 2013-02-19 21:28:15 +0700 -categories: [jekyll, update] +categories: [jekyll] --- You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. diff --git a/category/bash.md b/category/bash.md new file mode 100644 index 0000000000000000000000000000000000000000..e93af93ba60ac6e4cd96a9830537ffcf394b4f04 --- /dev/null +++ b/category/bash.md @@ -0,0 +1,6 @@ +--- +layout: posts_by_category +categories: bash +title: Bash +permalink: /category/bash +--- \ No newline at end of file diff --git a/category/django.md b/category/django.md new file mode 100644 index 0000000000000000000000000000000000000000..27d525b5351b3be95d4ee9db3a0a980b88fc2789 --- /dev/null +++ b/category/django.md @@ -0,0 +1,6 @@ +--- +layout: posts_by_category +categories: django +title: Django +permalink: /category/django +--- \ No newline at end of file diff --git a/category/jekyll.md b/category/jekyll.md new file mode 100644 index 0000000000000000000000000000000000000000..4d9513110272aaefff1386900081e1334152b43c --- /dev/null +++ b/category/jekyll.md @@ -0,0 +1,6 @@ +--- +layout: posts_by_category +categories: jekyll +title: Jekyll +permalink: /category/jekyll +--- \ No newline at end of file diff --git a/category/python.md b/category/python.md new file mode 100644 index 0000000000000000000000000000000000000000..3e85baf175dd3092fbd364fe2b16d171a38ae563 --- /dev/null +++ b/category/python.md @@ -0,0 +1,6 @@ +--- +layout: posts_by_category +categories: python +title: Python +permalink: /category/python +--- \ No newline at end of file diff --git a/category/ruby.md b/category/ruby.md new file mode 100644 index 0000000000000000000000000000000000000000..4d99243aa623c7dd31e799214057a325c629212b --- /dev/null +++ b/category/ruby.md @@ -0,0 +1,6 @@ +--- +layout: posts_by_category +categories: ruby +title: Ruby +permalink: /category/ruby +--- \ No newline at end of file