Skip to content

Commit

Permalink
Support all tags
Browse files Browse the repository at this point in the history
Instead of allowing only a subset of tag names, `slugify` the tag name
so that the URL is always valid.

This is the same thing done on "jekyll-archives":
-
https://github.com/jekyll/jekyll-archives/blob/master/lib/jekyll-archives/archive.rb#L132
  • Loading branch information
somini committed Nov 1, 2020
1 parent 6bc0f83 commit e54c046
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/jekyll-feed/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,9 @@ def generate_feed_by_tag

def generate_tag_feed(tags_pool, tags_path)
tags_pool.each do |tag|
# allow only tags with basic alphanumeric characters and underscore to keep
# feed path simple.
next if %r![^a-zA-Z0-9_]!.match?(tag)

tag_slug = Jekyll::Utils.slugify(tag)
Jekyll.logger.info "Jekyll Feed:", "Generating feed for posts tagged #{tag}"
path = "#{tags_path}#{tag}.xml"
path = "#{tags_path}#{tag_slug}.xml"
next if file_exists?(path)

@site.pages << make_page(path, :tags => tag)
Expand Down

0 comments on commit e54c046

Please sign in to comment.