Compare commits

...

2 commits

Author SHA1 Message Date
ded609da7d
Added support for entity linking in tags 2025-11-30 14:36:52 -05:00
56de4bacdb
Limit number of tags shown 2025-11-30 12:09:55 -05:00
2 changed files with 30 additions and 3 deletions

View file

@ -31,11 +31,15 @@
<div class="bloglist-item">
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
<p class="bloglist-item-tag">
{{ $tag_count := 0 }}
{{ range .Params.tags }}
{{ if lt $tag_count 2 }}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" (. | urlize)) }}
<span><a href="{{ .Permalink }}">#{{ $name }}</a> </span>
{{ end }}
{{ $tag_count = add $tag_count 1 }}
{{ end }}
{{ end }}
</p>
</div>

View file

@ -2,9 +2,32 @@
{{ partial "header.html" . }}
<main>
<div class='bloglist-teaser block-center' style="margin-top: 2rem;">
Here you'll find <strong>{{ len .Pages | lang.FormatNumber 0 }} posts</strong>
about <u>{{ .Title }}</u> </strong>.
<p>Here you'll find <strong>{{ len .Pages | lang.FormatNumber 0 }} post{{if gt (len .Pages) 1}}s{{end}}</strong>
about <u>{{ .Title }}</u>.</p>
<!-- Wikidata context -->
{{ $tagKey := .Title | urlize }}
{{ with index .Site.Data.wikidata_mappings $tagKey }}
<div class='wikidata-context block-center' style="margin-top: 1rem; margin-bottom: 2rem;">
{{ if eq (len .entities) 1 }}
{{ $entity := index .entities 0 }}
<p style="font-size: 1.25rem;">
Same as <a href="{{ $entity.url }}">{{ $entity.id }}</a>, {{ $entity.description }}.
</p>
{{ else }}
<p style="font-size: 1.25rem;"><strong>These posts may refer to:</strong></p>
<ul style="font-size: 1.25rem;">
{{ range .entities }}
<li>
<a href="{{ .url }}">{{ .id }}</a> {{ .description }}
</li>
{{ end }}
</ul>
{{ end }}
</div>
{{ end }}
</div>
<!-- contents -->
<div class="bloglist">
{{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "2006"}}
@ -19,4 +42,4 @@
{{ end }}
</div>
</main>
{{ end }}
{{ end }}