Skip to content

Commit

Permalink
fix: missing tags when its name is complicated
Browse files Browse the repository at this point in the history
e.g. `SSG (Static Site Generator)` or `Raspberry Pi(树莓派)`
  • Loading branch information
reuixiy committed Nov 17, 2019
1 parent 0f1f9ca commit aa106a7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions layouts/index.sectionsatom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@
{{ range $taxonomy, $terms := . }}
{{ with $page.Param $taxonomy }}
{{ range $index, $term := . }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxonomy ($term | anchorize)) }}
<category scheme="{{ .Permalink }}" term="{{ $term }}" label="{{ $term }}" />
{{ $url := urls.Parse ($term | urlize) }}
{{ $path := $url.Path }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxonomy $path) }}
<category scheme="{{ .Permalink }}" term="{{ .Title | default $term }}" label="{{ .Title | default $term }}" />
{{ end }}
{{ end }}
{{ end }}
Expand Down
6 changes: 4 additions & 2 deletions layouts/index.sectionsrss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@
{{ range $taxonomy, $terms := . }}
{{ with $page.Param $taxonomy }}
{{ range $index, $term := . }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxonomy ($term | anchorize)) }}
<category domain="{{ .Permalink }}">{{ $term }}</category>
{{ $url := urls.Parse ($term | urlize) }}
{{ $path := $url.Path }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxonomy $path) }}
<category domain="{{ .Permalink }}">{{ .Title | default $term }}</category>
{{ end }}
{{ end }}
{{ end }}
Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/minimal-footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{{ $length := sub (len .) 1 }}
<div class="post-tag">
{{- range $index, $tag := . -}}
{{- with $.Site.GetPage (printf `/tags/%s` $tag) -}}
{{- $url := urls.Parse ($tag | urlize) -}}
{{- $path := $url.Path -}}
{{- with $.Site.GetPage (printf `/tags/%s` $path) -}}
<a href="{{ .RelPermalink }}" rel="tag" class="post-tag-link">#{{ .Slug | default $tag | lower }}</a>
{{- if lt $index $length -}}
&nbsp;
Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/post-tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<div class="post-tags">
{{ range . }}
{{ $tag := . }}
{{ with $.Site.GetPage (printf `/tags/%s` .) }}
{{ $url := urls.Parse (. | urlize) }}
{{ $path := $url.Path }}
{{ with $.Site.GetPage (printf `/tags/%s` $path) }}
{{ $icon := (replace (index $.Site.Data.SVG $.Site.Params.postTagsIcon) "icon" "icon tag-icon") }}
<a href="{{ .RelPermalink }}" rel="tag" class="post-tags-link">{{ $icon | safeHTML }}{{ .LinkTitle | default $tag }}</a>
{{ end }}
Expand Down

0 comments on commit aa106a7

Please sign in to comment.