mirror of
https://github.com/foo-dogsquared/hugo-theme-contentful.git
synced 2025-01-31 04:58:03 +00:00
52 lines
1.8 KiB
HTML
52 lines
1.8 KiB
HTML
{{ define "main" }}
|
|
|
|
<header>
|
|
<h1>{{ .Title }}</h1>
|
|
|
|
<div class="post__meta">
|
|
<!-- List the author(s) of the article. -->
|
|
{{- with .Params.author }}
|
|
{{- $names := slice }}
|
|
{{- range . }}{{ $names = $names | append .name }}{{ end }}
|
|
<p class="author">{{ i18n "published_by" }}: {{ delimit $names ", " (printf " %s " (i18n "and")) }}</p>
|
|
{{- end }}
|
|
|
|
<!-- Only show the creation date if the `date` field is valid. -->
|
|
{{- if ne (.Date.Format "2006") "0001" }}
|
|
<!-- Publication date. -->
|
|
<p class="created-date">{{ i18n "published_on" }}: <date datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</date></p>
|
|
{{- end }}
|
|
|
|
<!-- Modification date (will only appear if the publication date is less than the modified date.) -->
|
|
{{- if ne .Date .Lastmod }}
|
|
<p class="updated-date">{{ i18n "updated_on" }}: <date datetime="{{ .Lastmod.Format "2006-01-02" }}">{{ .Lastmod.Format "2006-01-02" }}</date></p>
|
|
{{- end }}
|
|
|
|
<!-- Link the translated versions if the article has at least one translated page. -->
|
|
{{- if .IsTranslated }}
|
|
{{ $langs := slice }}
|
|
{{ range .Translations }}{{ $langs = $langs | append (printf "<a href=%s>%s</a>" .Permalink (cond (ne .Language.LanguageName nil) .Language.LanguageName .Lang)) }}{{ end }}
|
|
<p>{{ i18n "available_translations" }}: {{ delimit $langs "," (printf " %s " (i18n "and")) }}</p>
|
|
{{- end }}
|
|
</div>
|
|
</header>
|
|
|
|
<hr>
|
|
|
|
{{ $is_toc := cond (ne .Params.toc nil) .Params.toc $.Site.Params.toc }}
|
|
{{ if $is_toc }}
|
|
<style>
|
|
#TableOfContents:not(:empty)::before {
|
|
content: "{{ i18n "table_of_contents" }}";
|
|
font-weight: bold;
|
|
}
|
|
</style>
|
|
{{ .TableOfContents }}
|
|
{{ end }}
|
|
|
|
<article>
|
|
{{ .Content }}
|
|
</article>
|
|
|
|
{{ end }}
|