A bunch of layout changes to support a new category and make everything work better.

This commit is contained in:
Anna Rose 2016-05-22 21:49:37 -04:00
parent a053ac1be7
commit f5320c3717
8 changed files with 51 additions and 20 deletions

1
.ruby-gemset Normal file
View File

@ -0,0 +1 @@
annabunches

1
.ruby-version Normal file
View File

@ -0,0 +1 @@
2.3.1

View File

@ -23,14 +23,19 @@ timezone: America/New_York
markdown: kramdown
# Category settings
main_categories:
- technology
- media
category_titles:
technology: "The Technologist"
media: "The Player of Games"
religion: "The Mystic"
category_metadata:
technology:
title: "The Technologist"
description: This section of the blog is where I talk about technology. Tutorials, rants, and discussions about programming languages, operating systems, hardware, and more.
main: true
media:
title: "The Player of Games"
description: Here I talk about media. Video games, tabletop games, movies, TV.
main: true
religion:
title: "The Mystic"
description: Discussions of my adventures with faith, spirituality, truth, and magic. Lots of woo here.
main: false
defaults:
- scope:

View File

@ -0,0 +1,18 @@
<ul class="post-list">
{% for post in site.posts limit:include.limit %}
{% if post.main != false && (site.category_metadata[post.category][main] || post.main == true) %}
<li style="margin-top: 30px">
<h2 style="line-height: 1">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">
{{ post.title }}
</a>
<span class="post-meta">{{ post.date | date: "%Y-%m-%d" }}</span>
</h2>
{{ post.excerpt }}
<p>
<a href="{{ post.url | prepend: site.baseurl }}">Read More...</a>
</p>
</li>
{% endif %}
{% endfor %}
</ul>

View File

@ -8,6 +8,9 @@ layout: default
</header>
<div class="post-content">
<div class="category-description">
{{ page.description }}
</div>
{% include post_list.html categories=page.category limit=1000000 %}
</div>

View File

@ -9,8 +9,15 @@ class CategoryPage < Jekyll::Page
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
self.data['category'] = category
category_title = site.config["category_titles"][category] || category.capitalize
self.data['title'] = "#{category_title}"
config = site.config['category_metadata'][category]
if config.nil?
self.data['title'] = category.capitalize
self.data['description'] = ''
else
self.data['title'] = config['title']
self.data['description'] = config['description']
end
end
end
@ -22,7 +29,7 @@ class CategoryPageGenerator < Jekyll::Generator
return
end
site.categories.each_key do |category|
site.config['category_metadata'].each_key do |category|
site.pages << CategoryPage.new(site, site.source, category)
end
end

View File

@ -3,10 +3,10 @@ layout: default
---
<div class="home">
<div class="category-menu">
{% for category in site.category_titles %}
{% for category in site.category_metadata %}
<span class="category-link">
<a href="{{category.first | prepend: site.baseurl}}">
{{ category.last }}
{{ category.last["title"] }}
</a>
</span>
{% endfor %}
@ -22,15 +22,15 @@ layout: default
</div>
{% endif %}
{% include post_list.html categories=site.main_categories limit=10 %}
{% include post_list_main.html limit=10 %}
<p class="post-meta" style="margin-top: 40px">
For more posts, choose a category:
<ul>
{% for category in site.category_titles %}
{% for category in site.category_metadata %}
<li>
<a href="{{category.first | prepend: site.baseurl}}">
{{category.last}}
{{ category.last["title"]}}
</a>
</li>
{% endfor %}

View File

@ -1,4 +0,0 @@
---
layout: default
---
Sorry, there is nothing here yet.