converts tags to topics
This commit is contained in:
@ -30,8 +30,8 @@
|
||||
{{ end }}
|
||||
<meta name="description" content="{{ $description }}" />
|
||||
|
||||
{{/* Generate keywords from tags */}}
|
||||
{{ with .Params.tags }}
|
||||
{{/* Generate keywords from topics */}}
|
||||
{{ with .Params.topics }}
|
||||
<meta name="keywords" content="{{ delimit . ", " }}" />
|
||||
{{ end }}
|
||||
|
||||
@ -60,14 +60,14 @@
|
||||
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" />
|
||||
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" />
|
||||
<meta property="article:section" content="Oral History" />
|
||||
{{ with .Params.tags }}
|
||||
{{ with .Params.topics }}
|
||||
{{ range . }}
|
||||
<meta property="article:tag" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{/* Author information using standard meta tags instead of article:author */}}
|
||||
{{/* Author information using standard meta topics instead of article:author */}}
|
||||
{{ with .Params.narrator }}
|
||||
<meta name="author" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
@ -9,7 +9,7 @@
|
||||
</ul>
|
||||
|
||||
<section>
|
||||
<h2 class="text-4xl my-8 font-bold text-center">Other {{ .Data.Plural | title }}</h2>
|
||||
<h2 class="text-4xl my-8 font-bold text-center">Other {{ .Data.Plural }}</h2>
|
||||
<div class="tag-cloud font-iosevka text-gray-600 text-center">
|
||||
{{ $terms := index .Site.Taxonomies .Data.Plural }}
|
||||
{{ range $term, $pages := $terms }}
|
||||
|
@ -20,7 +20,7 @@
|
||||
{{ if .Params.location }}
|
||||
<p><strong>Location:</strong> {{ .Params.location }}</p>
|
||||
{{ end }}
|
||||
<p><strong>Topics:</strong> {{ partial "tags.html" . }}</p>
|
||||
<p><strong>Topics:</strong> {{ partial "topics.html" . }}</p>
|
||||
{{ if .Params.links }}
|
||||
<div class="mt-4">
|
||||
<p><strong>Narrator Links:</strong></p>
|
||||
@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</article>
|
||||
<aside class="max-w-screen-xl mx-auto px-4 lg:px-0">
|
||||
{{ partial "related-articles" (dict "page" . "tags" .Params.tags "limit" 3) }}
|
||||
{{ partial "related-articles" (dict "page" . "topics" .Params.topics "limit" 3) }}
|
||||
</aside>
|
||||
<div class="text-center my-12"><a href="/">Go Home</a></div>
|
||||
{{ end }}
|
@ -14,9 +14,9 @@
|
||||
<section>
|
||||
<h2 class="text-2xl mb-4 font-bold">Topics</h2>
|
||||
<div class="tag-cloud font-iosevka text-gray-600 text-sm">
|
||||
{{ $tags := .Site.Taxonomies.tags }}
|
||||
{{ range $tag, $pages := $tags }}
|
||||
<a href="{{ "/tags/" | relLangURL }}{{ $tag | urlize }}" style="font-size: {{ add 1 (div (len $pages) 2) }}em;" data-count="{{ len $pages}}"
|
||||
{{ $topics := .Site.Taxonomies.topics }}
|
||||
{{ range $tag, $pages := $topics }}
|
||||
<a href="{{ "/topics/" | relLangURL }}{{ $tag | urlize }}" style="font-size: {{ add 1 (div (len $pages) 2) }}em;" data-count="{{ len $pages}}"
|
||||
class="tag inline-block p-2 my-1 border border-gray-100 rounded-lg hover:bg-yellow-100 whitespace-nowrap">
|
||||
{{ $tag }}
|
||||
</a>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<p class="text-gray-800 italic">{{ $page.Params.location }}</p>
|
||||
{{ end }}
|
||||
<p class="max-w-prose">{{ $page.Params.summary }}</p>
|
||||
{{ partial "tags.html" $page }}
|
||||
{{ partial "topics.html" $page }}
|
||||
</div>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
@ -1,15 +1,15 @@
|
||||
{{- $tags := .tags -}}
|
||||
{{- $topics := .topics -}}
|
||||
{{- $limit := default 3 .limit -}}
|
||||
{{- $currentPath := .page.RelPermalink -}}
|
||||
|
||||
{{- $related := where (where site.RegularPages "Type" "articles") "RelPermalink" "!=" $currentPath -}}
|
||||
{{- $matchingArticles := slice -}}
|
||||
|
||||
{{/* First try to find articles with matching tags */}}
|
||||
{{/* First try to find articles with matching topics */}}
|
||||
{{- range $related -}}
|
||||
{{- $matches := 0 -}}
|
||||
{{- range .Params.tags -}}
|
||||
{{- if in $tags . -}}
|
||||
{{- range .Params.topics -}}
|
||||
{{- if in $topics . -}}
|
||||
{{- $matches = add $matches 1 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@ -18,7 +18,7 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* If we found matching articles, sort by number of matching tags */}}
|
||||
{{/* If we found matching articles, sort by number of matching topics */}}
|
||||
{{- $finalArticles := slice -}}
|
||||
{{- if gt (len $matchingArticles) 0 -}}
|
||||
{{- $finalArticles = first $limit (sort $matchingArticles "matches" "desc") -}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{- if .Params.tags }}
|
||||
{{- if .Params.topics }}
|
||||
<div class="flex flex-wrap gap-2 my-2 text-xs font-iosevka">
|
||||
{{- range .Params.tags }}
|
||||
<a href="{{ "tags/" | relURL }}{{ . | urlize }}"
|
||||
{{- range .Params.topics }}
|
||||
<a href="{{ "topics/" | relURL }}{{ . | urlize }}"
|
||||
class="px-3 py-1 border border-green-100 hover:bg-green-300 text-green-900 rounded no-underline">
|
||||
{{ . }}
|
||||
</a>
|
Reference in New Issue
Block a user