X-Git-Url: https://git.ralfj.de/web.git/blobdiff_plain/371a2f79f59831a0bc0295c1d7df8c1ff0ad6468..1b16aa2e24a61ab700ea19ea9bc45993d87f83b2:/personal/_plugins/categories.rb diff --git a/personal/_plugins/categories.rb b/personal/_plugins/categories.rb index 65776d7..3e0fabe 100644 --- a/personal/_plugins/categories.rb +++ b/personal/_plugins/categories.rb @@ -11,7 +11,7 @@ module Jekyll self.read_yaml(File.join(base, '_layouts'), layout) self.data['category'] = category # this tells the site template to add a link to the RSS feed - category_title_prefix = site.config['blog']['category_title_prefix'] || 'Category: ' + category_title_prefix = site.config['blog']['title'] + ": " self.data['title'] = "#{category_title_prefix}#{category.capitalize}" end end @@ -36,7 +36,7 @@ module Jekyll end # Adds some extra filters used during the category creation process. - module Filters + module CategoryFilter # Outputs a list of categories as comma-separated links. This is used # to output the category list for each post on a category page. @@ -45,11 +45,9 @@ module Jekyll # # Returns string def category_links(categories) - base_dir = @context.registers[:site].config['blog']['category_dir'] + cat_base_dir = File.join(@context.registers[:site].config['baseurl'], @context.registers[:site].config['blog']['category_dir']) categories = categories.sort!.map do |category| - category_url = File.join(base_dir, "#{category}.html") - # Make sure the category directory begins with a slash. - category_dir = "/#{category_dir}" unless category_dir =~ /^\// + category_url = File.join(cat_base_dir, "#{category}.html") "#{category.capitalize}" end @@ -64,3 +62,5 @@ module Jekyll end end end + +Liquid::Template.register_filter(Jekyll::CategoryFilter)