hugo-PaperMod/layouts/_default/single.html

96 lines
3.0 KiB
HTML

{{- define "main" }}
<article class="post-single">
<header class="post-header">
{{- if (.Param "ShowBreadCrumbs")}}
<div class="breadcrumbs">
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
{{- $lang_url := replace $url ( printf "%s" .Lang) "" }}
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a>
{{- range $index, $element := split $lang_url "/" }}
{{- $.Scratch.Add "path" (printf "%s/" $element )}}
{{- $bc_pg := $.Site.GetPage ($.Scratch.Get "path") -}}
{{- if (and ($bc_pg) (gt (len . ) 0))}}
{{- print "&nbsp;»&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a>
{{- end }}
{{- end }}
</div>
{{- end }}
<h1 class="post-title">
{{ .Title }}
{{- if .Draft }}<div class="entry-isdraft"><sup>&nbsp;&nbsp;[draft]</sup></div>{{- end }}
</h1>
{{- if .Description }}
<div class="post-description">
{{ .Description }}
</div>
{{- end }}
{{- if not (.Param "hideMeta") }}
<div class="post-meta">
{{- partial "post_meta.html" . -}}
{{- partial "translation_list.html" . -}}
</div>
{{- end}}
</header>
{{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden}}
{{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }}
{{- if (.Param "ShowToc") }}
<div class="toc">
<details {{if (.Param "TocOpen") }} open{{ end }}>
<summary accesskey="c" title="(Alt + C)">
<div class="details">{{- i18n "toc" | default "Table of Contents" }}</div>
</summary>
<div class="inner">
{{- partial "toc.html" . }}
</div>
</details>
</div>
{{- end }}
<div class="post-content">
{{- partial "anchored_headings.html" .Content -}}
</div>
<footer class="post-footer">
{{- if .Params.tags }}
<ul class="post-tags">
{{- range ($.GetTerms "tags") }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
{{- end }}
</ul>
{{- end }}
{{- if .Site.Params.ShowPostNavLinks }}
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- if and (gt (len $pages) 1) (in $pages . ) }}
<nav class="paginav">
{{- with $pages.Next . }}
<a class="prev" href="{{.Permalink}}">
<span class="title">« {{ i18n "prev_page" }}</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end}}
{{- with $pages.Prev . }}
<a class="next" href="{{.Permalink}}">
<span class="title">{{ i18n "next_page" }} »</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end}}
</nav>
{{- end }}
{{- end }}
{{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true) ) }}
{{- partial "share_icons.html" . }}
{{- end }}
</footer>
{{- if (.Param "comments") }}
{{- partial "comments.html" . }}
{{- end }}
</article>
{{- end }}{{/* end main */}}