Fixes #132 (Commit from @bgoldman)

This commit is contained in:
Brandon Goldman 2016-02-22 18:32:53 -08:00 committed by Panos Sakkos
parent 85fdf5b510
commit 5b589baa73
9 changed files with 119 additions and 8 deletions

View file

@ -10,3 +10,4 @@ In alphabetical order:
8. Panos Sakkos <panos.sakkos@protonmail.com>
9. Prashant Solanki <prs.solanki@live.com>
10. Sergey Lysenko <soulwish.ls@gmail.com>
11. Brandon Goldman <brandon.goldman@gmail.com>

View file

@ -9,7 +9,11 @@
{% assign post = site.posts.first %}
<h4> <strong> {{ post.date | date_to_string }} </strong>
<small>. {{ post.category }} .</small>
<small>.
<a class="category" href="{{site.baseurl}}/categories/{{post.category | downcase}}.html">
{{ post.category }}
</a>
.</small>
<strong> <a href="{{site.baseurl}}{{ post.url }}">{{post.title}} </a> </strong>
<small> <a href="{{site.baseurl}}{{post.url}}#disqus_thread">Comments</a></small>
</h4>

View file

@ -3,7 +3,11 @@
<h4 align="left">
<strong>{{ post.date | date_to_string }}</strong>
<small>. {{ post.category }} .</small>
<small>.
<a class="category" href="{{site.baseurl}}/categories/{{ post.category | downcase }}.html">
{{ post.category }}
</a>
.</small>
<br class="visible-xs-block">
<a href="{{site.baseurl}}{{post.url}}">
<strong>{{ post.title }}</strong>

40
_layouts/category.html Normal file
View file

@ -0,0 +1,40 @@
<!-- Category Layout Start -->
<!DOCTYPE html>
<html lang="{{ site.lang }}">
{% include head.html %}
<body>
{% include navigation.html %}
<section class="container content-section text-center">
<div class="row">
<div class="col-md-10 col-md-offset-1 col-xs-10 col-xs-offset-1">
{% assign category = page.title %}
<h3 id="#{{ category }}">Category: {{ category }}</h3>
<div>
{% for post in site.posts %}
{% if post.category == category %}
{% include post-list.html%}
{% endif %}
{% endfor %}
</div>
</div>
</div>
</section>
{% include footer.html %}
{% include js.html %}
</body>
</html>
<!-- Category Layout End -->

View file

@ -17,10 +17,17 @@
{% include swipe-instructions.html %}
<h1><strong>{{ page.title }}</strong></h1>
<h4><strong>{{ page.date | date_to_string }}</strong>
<small> . {{ page.category }} . <a href="{{site.baseurl}}{{page.url }}#disqus_thread">Comments</a>
<h4>
<strong>{{ page.date | date_to_string }}</strong>
<small>
. category:
<a class="category" href="{{site.baseurl}}/categories/{{page.category | downcase}}.html">
{{ page.category }}
</a>.
<a href="{{site.baseurl}}{{page.url }}#disqus_thread">Comments</a>
<br />
{% for tag in page.tags %}
<a href="{{site.baseurl}}/tags/{{tag}}.html">#{{ tag }}</a>
<a class="tag" href="{{site.baseurl}}/tags/{{tag}}.html">#{{ tag }}</a>
{% endfor %}
</small>
</h4>

6
categories/tech.html Normal file
View file

@ -0,0 +1,6 @@
---
layout: category
section-type: category
title: tech
---
## Category

View file

@ -36,6 +36,17 @@ h6 {
letter-spacing: 1px;
}
/* Added in { Personal } */
h4 {
a.category {
color: inherit;
}
a.tag {
font-size: 12px;
}
}
p {
margin: 0 0 25px;
font-size: 18px;
@ -256,6 +267,15 @@ a {
display: inline !important;
border: 1px solid $dark !important;
}
/* Added in { Personal } */
&#post {
div.author img {
border: 0px;
margin-bottom: 20px;
padding: 4px;
}
}
}
.btn {

View file

@ -10,6 +10,9 @@ serve
new-post <title>
- Creates a new post under \_posts
generate-category
- Generate all the categories that are used in the \_posts
generate-tag
- Generate all the tags that are used in the \_posts

26
scripts/generate-categories Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env ruby
require 'yaml'
POSTS_DIR = '_posts/'
CATEGORIES_DIR = 'categories/'
Dir.foreach(POSTS_DIR) do |post|
next if post == '.' or post == '..' or post == '.DS_Store'
postYaml = YAML.load_file(POSTS_DIR + post)
unless (postYaml['category'] == nil)
category = postYaml['category']
unless File.exist?(CATEGORIES_DIR + category.downcase + '.html')
puts('[+] Generating #' + category + ' page')
File.open(CATEGORIES_DIR + category.downcase + '.html', 'w') {|f| f.write(
"---\nlayout: category\nsection-type: category\ntitle: " + category + "\n---\n## Category")}
end
end
end