mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-31 19:57:57 +00:00
98 lines
3.5 KiB
HTML
98 lines
3.5 KiB
HTML
{{ define "main" }}
|
|
|
|
<article class="post--single">
|
|
<header>
|
|
<h1>{{ .Title }}</h1>
|
|
</header>
|
|
{{- partial "partials/components/post-meta.html" . }}
|
|
|
|
{{- $is_toc := cond (ne .Params.toc nil) .Params.toc $.Site.Params.toc }}
|
|
{{- if (and $is_toc (gt (countrunes .TableOfContents) 0)) }}
|
|
<style>
|
|
#TableOfContents:not(:empty)::before {
|
|
content: "{{ i18n "table_of_contents" }}";
|
|
font-weight: bold;
|
|
}
|
|
</style>
|
|
{{ .TableOfContents }}
|
|
{{ end }}
|
|
|
|
<main>
|
|
{{ .Content }}
|
|
</main>
|
|
|
|
<hr>
|
|
{{ $timeFmt := "2006-01-02 15:04:05 -0700" }}
|
|
<div class="post__meta--single">
|
|
{{- with .Params.author }}
|
|
{{- $names := slice }}
|
|
{{- range . }}{{ $names = $names | append .name }}{{ end }}
|
|
<p data-content-author="{{ jsonify $names }}">
|
|
<span>{{ i18n "published_by" }}</span>
|
|
<span>{{ delimit $names ", " (printf " %s " (i18n "and")) }}</span>
|
|
</p>
|
|
{{- end -}}
|
|
|
|
{{- /* Only show the creation date if the `date` field is valid. */ -}}
|
|
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
|
<p data-content-publication-date="{{ .PublishDate }}">
|
|
<span>Published:</span>
|
|
<span><time datetime="{{ .PublishDate.Format $timeFmt }}">{{ .PublishDate.Format $timeFmt }}</time></span>
|
|
</p>
|
|
{{- end }}
|
|
|
|
{{- /* Publication date */ -}}
|
|
{{- if and (ne (.Date.Format "2006") "0001") (ne .Date .PublishDate) -}}
|
|
<p data-content-creation-date="{{ .Date }}">
|
|
<span>Created:</span>
|
|
<span><time datetime="{{ .Date.Format "2006-01-02 15:04:05 -0700" }}">{{ .Date.Format $timeFmt }}</time></span>
|
|
</p>
|
|
{{- end }}
|
|
|
|
{{- /* Modification date (will only appear if the publication date is less than the modified date.) */ -}}
|
|
{{- if ne .Date .Lastmod }}
|
|
<p data-content-modification-date="{{ .Lastmod }}">
|
|
<span>{{ i18n "updated_on" }}:</span>
|
|
<span><time datetime="{{ .Lastmod.Format "2006-01-02 15:04:05 -0700" }}">{{ .Lastmod.Format $timeFmt }}</time></span>
|
|
</p>
|
|
{{- end }}
|
|
|
|
{{- /* Link the translated versions if the article has at least one translated page. */ -}}
|
|
{{- if .IsTranslated }}
|
|
{{- $lang_links := slice }}
|
|
{{- $langs := slice }}
|
|
{{- range .Translations }}
|
|
{{- $lang := cond (ne .Language.LanguageName nil) .Language.LanguageName .Lang }}
|
|
{{- $lang_links = $lang_links | append (printf "<a href=%s>%s</a>" .Permalink $lang) }}
|
|
{{- $langs = $langs | append $lang }}
|
|
{{- end }}
|
|
<p data-content-translations="{{ jsonify $langs }}">
|
|
<span>{{ i18n "available_translations" }}:</span>
|
|
<span>{{ delimit $lang_links "," (printf " %s " (i18n "and")) }}</span>
|
|
</p>
|
|
{{- end }}
|
|
|
|
{{- with .Params.tags }}
|
|
{{- $tags := slice }}
|
|
{{- range $index, $tag := . }}
|
|
{{- $tag := printf `<a href="%s#%s">%s</a>` ("/tags" | relLangURL) ($tag | urlize) $tag }}
|
|
{{- $tags = $tags | append $tag }}
|
|
{{- end }}
|
|
<p data-content-tags="{{ jsonify $tags }}">
|
|
<span>Topic:</span>
|
|
<span>{{ delimit $tags "." }}</span>
|
|
</p>
|
|
{{- end -}}
|
|
|
|
{{- with .GitInfo }}
|
|
<p data-content-hash="{{ .Hash }}">
|
|
<span>Hash:</span>
|
|
<span>{{ .Hash }}</span>
|
|
</p>
|
|
{{- end -}}
|
|
</div>
|
|
</article>
|
|
|
|
{{ end }}
|
|
|