Skip to content

Commit

Permalink
fix: ugly encoded URLs in post-copyright
Browse files Browse the repository at this point in the history
closes #24
  • Loading branch information
reuixiy committed Nov 21, 2019
1 parent 0e8adda commit 0efad4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion layouts/partials/post-copyright.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<ul class="post-copyright">
<li class="copyright-item author">{{ with $author.website }}{{ printf `%s<a href="%s" target="_blank">%s</a>` (i18n "copyrightAuthor") . $author.name | safeHTML }}{{ else }}{{ printf `%s%s` (i18n "copyrightAuthor") $author.name }}{{ end }}</li>
{{ if $.Params.original | default $.Site.Params.original }}
<li class="copyright-item link">{{ printf `%s<a href="%s" target="_blank">%s</a>` (i18n "copyrightLink") $.RelPermalink $.Permalink | safeHTML }}</li>
{{ $url := urls.Parse $.Permalink }}
{{ $decodedPath := $url.Path }}
{{ $baseURLWithLangFix := (strings.TrimSuffix "/" (print `/` | absLangURL)) }}
{{ $decodedPermalink := (printf `%s%s` $baseURLWithLangFix $decodedPath) }}
<li class="copyright-item link">{{ printf `%s<a href="%s" target="_blank">%s</a>` (i18n "copyrightLink") $.RelPermalink $decodedPermalink | safeHTML }}</li>
{{ else }}
{{ with $.Params.link }}
<li class="copyright-item link">{{ printf `%s<a href="%s" target="_blank">%s</a>` (i18n "copyrightLink") . . | safeHTML }}</li>
Expand Down

0 comments on commit 0efad4c

Please sign in to comment.