main
html 35 lines 2.1 KB
Raw
1 {{- $page := . -}}
2 {{- $meta := slice -}}
3 {{- if not $page.Date.IsZero -}}
4 {{- $meta = $meta | append (printf "<time datetime=%q>%s</time>" ($page.Date.Format "2006-01-02T15:04:05Z07:00") ($page.Date.Format "Jan 2, 2006")) -}}
5 {{- end -}}
6 {{- if $page.ReadingTime -}}
7 {{- $meta = $meta | append (printf "%d min read" $page.ReadingTime) -}}
8 {{- end -}}
9 {{- with $page.Params.week -}}
10 {{- $meta = $meta | append . -}}
11 {{- end -}}
12 {{- with $page.Params.repos_featured -}}
13 {{- $meta = $meta | append (printf "%v repos featured" .) -}}
14 {{- end -}}
15 {{- with $page.Params.top_repo -}}
16 {{- $meta = $meta | append (printf "Top repo: %s" .) -}}
17 {{- end -}}
18 {{- $showArticleMetaActions := or (eq $page.Section "weekly") (eq $page.Section "topics") -}}
19 {{- $showAIBadge := $showArticleMetaActions -}}
20 {{- $reportIssueURL := printf "https://github.com/jmservera/SquadScope/issues/new?title=Errata%%3A%%20%s&labels=errata&body=Article%%3A%%20%s%%0A%%0AThe%%20issue%%20I%%20noticed%%3A%%0A%%0A" ($page.Title | urlquery) ($page.Permalink | urlquery) -}}
21 {{- if or (gt (len $meta) 0) $showAIBadge $showArticleMetaActions -}}
22 <p class="article-meta" aria-label="Report metadata">
23 {{- if gt (len $meta) 0 -}}
24 {{ delimit $meta " <span aria-hidden=\"true\">·</span> " | safeHTML }}
25 {{- end -}}
26 {{- if and (gt (len $meta) 0) $showAIBadge }} <span aria-hidden="true">·</span> {{ end -}}
27 {{- if $showAIBadge -}}
28 <span class="article-ai-badge" title="This analysis was written by an AI model using public GitHub + press data. Editorial structure and source curation by the Claracle maintainer." aria-label="AI-generated analysis. This analysis was written by an AI model using public GitHub and press data. Editorial structure and source curation by the Claracle maintainer.">✨ AI-generated analysis</span>
29 {{- end -}}
30 {{- if and (or (gt (len $meta) 0) $showAIBadge) $showArticleMetaActions }} <span aria-hidden="true">·</span> {{ end -}}
31 {{- if $showArticleMetaActions -}}
32 <a class="article-report-link" href="{{ $reportIssueURL }}" target="_blank" rel="noopener">Report an issue with this article</a>
33 {{- end -}}
34 </p>
35 {{- end -}}