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)
|
def category_links(categories)
|
||||||
dir = @context.registers[:site].config['category_dir']
|
dir = @context.registers[:site].config['category_dir']
|
||||||
categories = categories.sort!.map do |item|
|
categories = categories.sort!.map do |item|
|
||||||
if dir.nil? or dir.empty?
|
url = item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase
|
||||||
"<a class='category' href='/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>"
|
url = "#{dir}/#{url}" unless dir.nil? or dir.empty?
|
||||||
else
|
"<a class='category' href='/#{url}/'>#{item}</a>"
|
||||||
"<a class='category' href='/#{dir}/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
case categories.length
|
case categories.length
|
||||||
|
Loading…
Reference in New Issue
Block a user