mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-11-16 06:05:00 -05:00
removed some duplication from category url generation
This commit is contained in:
parent
5e666bfe6b
commit
c06ba58466
@ -150,11 +150,9 @@ module Jekyll
|
||||
def category_links(categories)
|
||||
dir = @context.registers[:site].config['category_dir']
|
||||
categories = categories.sort!.map do |item|
|
||||
if dir.nil? or dir.empty?
|
||||
"<a class='category' href='/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>"
|
||||
else
|
||||
"<a class='category' href='/#{dir}/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>"
|
||||
end
|
||||
url = item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase
|
||||
url = "#{dir}/#{url}" unless dir.nil? or dir.empty?
|
||||
"<a class='category' href='/#{url}/'>#{item}</a>"
|
||||
end
|
||||
|
||||
case categories.length
|
||||
|
Loading…
Reference in New Issue
Block a user