Skip to content

Commit 58ffaff

Browse files
committed
Slug: Remove punctuation, rather than replace with a hyphen.
1 parent 8a55592 commit 58ffaff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/jekyll-archives/archive.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def initialize(site, name, type, posts)
2828
@name = name
2929

3030
# Generate slug if tag or category (taken from jekyll/jekyll/features/support/env.rb)
31-
@slug = name.downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-') if name.is_a? String
31+
if name.is_a? String
32+
@slug = name.split(" ").map { |w|
33+
w.downcase.gsub(/[^\w]/, '')
34+
}.join("-")
35+
end
3236

3337
# Use ".html" for file extension and url for path
3438
@ext = ".html"

0 commit comments

Comments
 (0)