From 5b589baa7398d242a6cceec8d3ca1614601fec29 Mon Sep 17 00:00:00 2001 From: Brandon Goldman Date: Mon, 22 Feb 2016 18:32:53 -0800 Subject: [PATCH] Fixes #132 (Commit from @bgoldman) --- CONTRIBUTORS.md | 1 + _includes/latest-post.html | 6 +++++- _includes/post-list.html | 6 +++++- _layouts/category.html | 40 +++++++++++++++++++++++++++++++++++++ _layouts/post.html | 17 +++++++++++----- categories/tech.html | 6 ++++++ css/grayscale.scss | 20 +++++++++++++++++++ scripts/README.md | 5 ++++- scripts/generate-categories | 26 ++++++++++++++++++++++++ 9 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 _layouts/category.html create mode 100644 categories/tech.html create mode 100755 scripts/generate-categories diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cf5f75e..0672ec0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -10,3 +10,4 @@ In alphabetical order: 8. Panos Sakkos 9. Prashant Solanki 10. Sergey Lysenko + 11. Brandon Goldman diff --git a/_includes/latest-post.html b/_includes/latest-post.html index a2563c3..29b1cfe 100644 --- a/_includes/latest-post.html +++ b/_includes/latest-post.html @@ -9,7 +9,11 @@ {% assign post = site.posts.first %}

{{ post.date | date_to_string }} - . {{ post.category }} . + . + + {{ post.category }} + + . {{post.title}} Comments

diff --git a/_includes/post-list.html b/_includes/post-list.html index 23432cc..3f5d8fc 100644 --- a/_includes/post-list.html +++ b/_includes/post-list.html @@ -3,7 +3,11 @@

{{ post.date | date_to_string }} - . {{ post.category }} . + . + + {{ post.category }} + + .
{{ post.title }} diff --git a/_layouts/category.html b/_layouts/category.html new file mode 100644 index 0000000..b0f2049 --- /dev/null +++ b/_layouts/category.html @@ -0,0 +1,40 @@ + + + + + + + {% include head.html %} + + + + {% include navigation.html %} + +
+
+
+ + {% assign category = page.title %} + +

Category: {{ category }}

+ +
+ {% for post in site.posts %} + {% if post.category == category %} + {% include post-list.html%} + {% endif %} + {% endfor %} +
+ +
+
+
+ + {% include footer.html %} + + {% include js.html %} + + + + + diff --git a/_layouts/post.html b/_layouts/post.html index 27baf3b..21c58d6 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -17,11 +17,18 @@ {% include swipe-instructions.html %}

{{ page.title }}

-

{{ page.date | date_to_string }} - . {{ page.category }} . Comments - {% for tag in page.tags %} - #{{ tag }} - {% endfor %} +

+ {{ page.date | date_to_string }} + + . category: + + {{ page.category }} + . + Comments +
+ {% for tag in page.tags %} + #{{ tag }} + {% endfor %}

diff --git a/categories/tech.html b/categories/tech.html new file mode 100644 index 0000000..165288e --- /dev/null +++ b/categories/tech.html @@ -0,0 +1,6 @@ +--- +layout: category +section-type: category +title: tech +--- +## Category \ No newline at end of file diff --git a/css/grayscale.scss b/css/grayscale.scss index 2525c43..fe5be78 100644 --- a/css/grayscale.scss +++ b/css/grayscale.scss @@ -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 { diff --git a/scripts/README.md b/scripts/README.md index cc63338..109a0fb 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,6 +1,6 @@ install - Installs jekyll and the dependencies required by personal-jekyll-theme - + serve-production - Builds and serves your website in 127.0.0.1:4000 @@ -10,6 +10,9 @@ serve new-post - 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 diff --git a/scripts/generate-categories b/scripts/generate-categories new file mode 100755 index 0000000..685c9fe --- /dev/null +++ b/scripts/generate-categories @@ -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