mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-24 19:41:37 +01:00
75855b2758
* adds Breadcrumb nav above title of single page/post * add enabler var 'ShowBreadCrumbs' * introduce i18n var "home" usage: in site config: Params: ShowBreadCrumbs: true in page front-matter: ShowBreadCrumbs: false
112 lines
3.6 KiB
HTML
112 lines
3.6 KiB
HTML
{{- define "main" }}
|
|
|
|
<article class="post-single">
|
|
<header class="post-header">
|
|
{{- if (.Param "ShowBreadCrumbs")}}
|
|
<div class="breadcrumbs">
|
|
{{- $url := replace .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 " » " | 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> [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" . -}}
|
|
{{- if .IsTranslated -}}
|
|
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }} | {{- end -}}
|
|
<ul class="i18n_list">
|
|
{{- i18n "translations" | default "Translations"}}:
|
|
{{- range .Translations }}
|
|
<li>
|
|
<a href="{{ .Permalink }}">
|
|
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
|
|
{{- .Language.LanguageName | emojify | humanize -}}
|
|
{{- else }}
|
|
{{- .Lang | humanize -}}
|
|
{{- end -}}
|
|
</a>
|
|
</li>
|
|
{{- end }}
|
|
</ul>
|
|
{{- end }}
|
|
</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 */}}
|