diff options
Diffstat (limited to 'src/guff/handlers')
-rw-r--r-- | src/guff/handlers/blog.cr | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/guff/handlers/blog.cr b/src/guff/handlers/blog.cr index 21e7db7..b961955 100644 --- a/src/guff/handlers/blog.cr +++ b/src/guff/handlers/blog.cr @@ -227,7 +227,7 @@ class Guff::Handlers::BlogHandler < Guff::Handler tag: " <li class='tag'> <a - href='%{name}/' + href='%{p}%{name}/' title='View posts matching tag %{name}.' > %{name} (%{num_posts} posts) @@ -237,12 +237,17 @@ class Guff::Handlers::BlogHandler < Guff::Handler }) private def draw_tags(context, tags) + # generate tag url prefix + p = (context.request.path || "").match(/\/$/) ? "" : "./tag/" + # create page page = PageHTMLView.new( title: "Tags", body: TAG_TEMPLATES[:body].run({ "tags": tags.map { |row| - TAG_TEMPLATES[:tag].run(row.reduce({} of String => String) do |r, k, v| + TAG_TEMPLATES[:tag].run(row.reduce({ + "p": p + }) do |r, k, v| r[k] = HTML.escape(v.to_s) r end) |