forked from barryclark/jekyll-now
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tag lists, sidebar, and other goodies
- Loading branch information
Showing
21 changed files
with
242 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div class="sidebar col-sm-4"> | ||
<p class="author_name">by <a href="http://homepages.inf.ed.ac.uk/csutton/">Charles Sutton</a></p> | ||
|
||
<h1>Recent Posts</h1> | ||
|
||
<ul> | ||
{% for post in site.posts limit:5 %} | ||
<li><a href="{{ post.url }}">{{ post.title }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<h1>Most Popular</h1> | ||
<ul> | ||
{% for post in site.tags.popular limit:5 %} | ||
<li><a href="{{ post.url }}">{{ post.title }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<h1>Topics</h1> | ||
<ul> | ||
{% assign sorted_tags = site.tags | sort %} | ||
{% for tag in sorted_tags %} | ||
{% if tag[0] != 'popular' %} | ||
{% assign tag_len = tag[1].size %} | ||
{% if tag_len > 1 %} | ||
<li><a href="/tag/{{tag[0]}}">{{ tag[0] }}</a> ({{ tag_len }})</li> | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
</ul> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{% if include.thingy.tags.size > 0 %} | ||
<div class="tags"> | ||
Tags: | ||
{% for tag in include.thingy.tags %} | ||
<span class="tag"><a href="/tags/{{ tag }}">{{ tag }}</a></span>{% unless forloop.last %}, {% endunless %} | ||
<span class="tag"><a href="/tag/{{ tag }}">{{ tag }}</a></span>{% unless forloop.last %}, {% endunless %} | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
layout: default | ||
--- | ||
<div class="row"> | ||
|
||
<div class="col-sm-12"> | ||
<h2 class="post_title">{{page.title}}</h2> | ||
</div> | ||
|
||
{% for post in site.posts %} | ||
{% for tag in post.tags %} | ||
{% if tag == page.tag %} | ||
<div class="col-xs-6 tag-index-summary"> | ||
<time style="color:#666;font-size:11px;" datetime='{{post.date | date: "%Y-%m-%d"}}'>{{post.date | date: "%m/%d/%y"}}</time> <a class="archive_list_article_link" href='{{post.url}}'>{{post.title}}</a> | ||
<p class="summary">{{post.excerpt}} (<a href='{{post.url}}'>read more</a>)</p> | ||
</div> | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# via http://charliepark.org/tags-in-jekyll/ | ||
|
||
module Jekyll | ||
|
||
class TagIndex < Page | ||
def initialize(site, base, dir, tag) | ||
@site = site | ||
@base = base | ||
@dir = dir | ||
@name = 'index.html' | ||
self.process(@name) | ||
self.read_yaml(File.join(base, '_layouts'), 'tag_index.html') | ||
self.data['tag'] = tag | ||
tag_title_prefix = site.config['tag_title_prefix'] || 'Posts Tagged “' | ||
tag_title_suffix = site.config['tag_title_suffix'] || '”' | ||
self.data['title'] = "#{tag_title_prefix}#{tag}#{tag_title_suffix}" | ||
end | ||
end | ||
|
||
|
||
class TagGenerator < Generator | ||
safe true | ||
def generate(site) | ||
if site.layouts.key? 'tag_index' | ||
dir = site.config['tag_dir'] || 'tag' | ||
site.tags.keys.each do |tag| | ||
write_tag_index(site, File.join(dir, tag), tag) | ||
end | ||
end | ||
end | ||
|
||
def write_tag_index(site, dir, tag) | ||
index = TagIndex.new(site, site.source, dir, tag) | ||
index.render(site.layouts, site.site_payload) | ||
index.write(site.dest) | ||
site.pages << index | ||
end | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Jekyll | ||
|
||
class TagIndex < Page | ||
def initialize(site, base, dir, tag) | ||
@site = site | ||
@base = base | ||
@dir = dir | ||
@name = 'index.html' | ||
self.process(@name) | ||
self.read_yaml(File.join(base, '_layouts'), 'tag_index.html') | ||
self.data['tag'] = tag | ||
tag_title_prefix = site.config['tag_title_prefix'] || 'Posts Tagged “' | ||
tag_title_suffix = site.config['tag_title_suffix'] || '”' | ||
self.data['title'] = "#{tag_title_prefix}#{tag}#{tag_title_suffix}" | ||
end | ||
end | ||
|
||
|
||
class TagGenerator < Generator | ||
safe true | ||
def generate(site) | ||
if site.layouts.key? 'tag_index' | ||
dir = site.config['tag_dir'] || 'tag' | ||
site.tags.keys.each do |tag| | ||
write_tag_index(site, File.join(dir, tag), tag) | ||
end | ||
end | ||
end | ||
|
||
def write_tag_index(site, dir, tag) | ||
index = TagIndex.new(site, site.source, dir, tag) | ||
index.render(site.layouts, site.site_payload) | ||
index.write(site.dest) | ||
site.pages << index | ||
end | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...s/2016-12-28-a-suggestion-for-scotland.md → ...s/2014-02-28-a-suggestion-for-scotland.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.