diff --git a/_layouts/post.html b/_layouts/post.html index f2231e7f028c404c2b294a752952c04dd022e1a5..79cb2115091c9d367f53ff7092347bf6ff981e70 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -7,3 +7,32 @@ layout: default <div class="content"> <div class="post">{{ content }}</div> </div> + +{% assign hasSimilar = '' %} +{% for post in site.posts %} + {% assign postHasSimilar = false %} + {% for tag in post.categories %} + {% for thisTag in page.categories %} + {% if postHasSimilar == false and hasSimilar.size < 6 and post != page and tag == thisTag %} + {% if hasSimilar.size == 0 %} + <div class="panel-body"> + <h4>Related Posts</h4> + <ul> + {% endif %} + <li class="relatedPost"> + <a href="{{ site.url }}{{ post.url }}">{{ post.title }} + {% if post.categories %} + (Categories: {{ post.categories | join: ', ' }}) + {% endif %} + </a> + </li> + {% capture hasSimilar %}{{ hasSimilar }}*{% endcapture %} + {% assign postHasSimilar = true %} + {% endif %} + {% endfor %} + {% endfor %} +{% endfor %} +{% if hasSimilar.size > 0 %} + </ul> + </div> +{% endif %} diff --git a/_posts/2013-12-23-ruby-json.markdown b/_posts/2013-12-23-ruby-json.markdown index 9a299bcd1720a304c227f7c79bc9273a72527c7b..f0da76efbd1fd39202a0604fd71c2c4884a50136 100644 --- a/_posts/2013-12-23-ruby-json.markdown +++ b/_posts/2013-12-23-ruby-json.markdown @@ -2,7 +2,7 @@ layout: post title: "Parsing JSON with Ruby" date: 2013-12-23 00:18:23 +0700 -categories: ruby +categories: [ruby] --- Parsing JSON with Ruby is actually extremely easy. All you have to do is have the json gem installed (`gem install json`) and call the `JSON.parse` method on the JSON data to convert it to ruby hashes. If you look at this small program here, you can see how I have implemented parsing JSON in Ruby. diff --git a/_posts/2013-12-23-welcome-to-simply-grey.markdown b/_posts/2013-12-23-welcome-to-simply-grey.markdown index 1e96a0e57000fd37ef57fed3a099fd7730016de6..1d4ed27ab7a5d5c606d01d79679b5839f0be1375 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: [simplygrey] --- 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-email-backend-with-smtp-gmail.markdown b/_posts/2016-04-19-email-backend-with-smtp-gmail.markdown index 7227fac001b3d178c940e00d82aa0677175eaf6f..62e21185bd70faf75ffd6b7079f6d29b32246664 100644 --- a/_posts/2016-04-19-email-backend-with-smtp-gmail.markdown +++ b/_posts/2016-04-19-email-backend-with-smtp-gmail.markdown @@ -2,7 +2,7 @@ layout: post title: "Email BackEnd with SMTP Gmail" date: 2016-04-19 02:28:15 +0700 -categories: django +categories: [python, django] --- Add this configurations in your `settings.py` diff --git a/_posts/2016-04-19-remove-all-files-pyc-with-recrusive-method.markdown b/_posts/2016-04-19-remove-all-files-pyc-with-recrusive-method.markdown index 44aaf5696333c4f140f2cf311757313e0a1c4e48..6093cbfc0f34b5eac4179748e238b27e07e09f01 100644 --- a/_posts/2016-04-19-remove-all-files-pyc-with-recrusive-method.markdown +++ b/_posts/2016-04-19-remove-all-files-pyc-with-recrusive-method.markdown @@ -2,7 +2,7 @@ layout: post title: "Remove all files .pyc with recrusive method" date: 2016-04-19 14:39:34 +0700 -categories: python bash +categories: [python, bash] --- This method simple but important. Example in your project dir is like this: diff --git a/_posts/2016-04-19-welcome-to-jekyll.markdown b/_posts/2016-04-19-welcome-to-jekyll.markdown index 8ba41879f9c86c859279b9938308df24b3d9fc3c..2e057b4a5408c1f6896ab35342b4c2f2e855e0d9 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, update] --- 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.