diff --git a/_plugins/year_utilities.rb b/_plugins/year_utilities.rb new file mode 100644 index 00000000..37253a64 --- /dev/null +++ b/_plugins/year_utilities.rb @@ -0,0 +1,34 @@ +# {% year_utilities %} +# Returns a list of links to all years that have posts in them +# +# To install, copy this file into your Jekyll/Octopress plugins folder +# To use: {% year_utilities PARAMETER %} +# +# PARAMETER can be: +# year_links (returns a list of links to all years that have posts in them) + +module Jekyll + class YearUtilities < Liquid::Tag + def initialize(tag, text, tokens) + super + @tag = tag + @text = text.strip + @tokens = tokens + end + + def render(context) + the_result = nil + + all_posts = context.registers[:site].posts.docs + years = all_posts.map { |post| post.date.year }.uniq + + if @text.start_with? "year_links" + years.map { |year| "#{year}" }.join(', ') + end + + return the_result + end + end +end + +Liquid::Template.register_tag('year_utilities', Jekyll::YearUtilities) diff --git a/archives.md b/archives.md new file mode 100644 index 00000000..7de2980b --- /dev/null +++ b/archives.md @@ -0,0 +1,7 @@ +--- +layout: page +title: Archives +--- + +