Skip to content

Commit

Permalink
theme(fix): broken link in tagoverview
Browse files Browse the repository at this point in the history
solves the issue with the current tag not being marked fat too.

closes #930
  • Loading branch information
davidsneighbour committed May 12, 2024
1 parent 8a58da3 commit 630f240
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
30 changes: 18 additions & 12 deletions layouts/partials/content/components/tags/tags-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,38 @@
{{- $icon = . -}}
{{- end -}}

{{- $page := .context -}}

{{- if eq (.type | default "page") "page" -}}
{{- range .tags -}}
{{- partialCached "tags/single-tag.html" . . -}}
{{- end -}}
{{- else -}}
{{- partialCached "tags/taglist.html" .context -}}
{{- partial "tags/taglist.html" (dict "context" $page) -}}
{{- end -}}

{{- define "partials/tags/taglist.html" -}}

{{- $current := page.Name -}}
{{- $page := .context -}}
{{- $current := dict -}}
{{ with $page.Name }}
{{- $current = . -}}
{{ end }}

<div class="container">
<div class="row py-6">
<div class="col text-center">
<ul class="list-inline">
{{- range $index, $value := (collections.Index site.Taxonomies .Type) -}}
{{- range (collections.Index site.Taxonomies $page.Type) -}}
{{- if compare.Gt .Count 1 -}}
<li class="list-inline-item mx-2">
{{- /* @todo do this with page object methods */ -}}
<a href="/tags/{{ $index }}/" class="text-decoration-none">
{{- if compare.Eq $current $index -}}<strong>{{- end -}}
{{- partials.Include "icon.html" "tag-fill" -}}
{{- $index -}} ({{- .Count -}})
{{- if compare.Eq $current $index -}}</strong>{{- end -}}
</a>
</li>
<li class="list-inline-item mx-2">
<a href="{{- .Page.RelPermalink -}}" class="text-decoration-none">
{{- if compare.Eq $current .Page.Name -}}<strong>{{- end -}}
{{- partials.Include "icon.html" "tag-fill" -}}
{{- .Page.Name }} ({{ .Count -}})
{{- if compare.Eq $current .Page.Name -}}</strong>{{- end -}}
</a>
</li>
{{- end -}}
{{- end -}}
</ul>
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/content/components/tags/tags.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- $page := . -}}
{{- with (.GetTerms "tags") -}}
<div class="is--tags">
{{- $options := dict "tags" . "type" "page" "icon" "tag-fill" -}}
{{- $options := dict "tags" . "type" "page" "icon" "tag-fill" "context" $page -}}
{{- partial "content/components/tags/tags-overview.html" $options -}}
</div>
{{- end -}}

0 comments on commit 630f240

Please sign in to comment.