hugo-theme-anubis2/layouts/_default/single.html

82 lines
3.0 KiB
HTML
Raw Normal View History

2020-01-12 07:51:51 +01:00
{{ define "main" }}
2024-04-09 14:22:28 +02:00
{{/* {{ if .Menus }}
2020-06-24 21:21:59 +02:00
<nav class="post-navigation">
{{ range .Menus }}
2023-08-12 10:28:38 +02:00
<a href="{{ .ConfiguredURL | absLangURL }}" title="{{ .Title }}">{{ .Name | markdownify }}</a>
2020-06-24 21:21:59 +02:00
{{ end }}
</nav>
2024-04-09 14:22:28 +02:00
{{ end }} */}}
<article class="post h-entry">
<div class="post-header">
<header>
2023-08-12 10:28:38 +02:00
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}">{{ trim .Title " " | markdownify }}</h1>
{{ partial "post-language-switcher.html" . }}
</header>
2024-03-04 08:05:53 +01:00
{{ partial "post-info.html" . }}
</div>
2023-07-04 21:29:38 +02:00
{{ partial "toc.html" .}}
<div class="content e-content">
2020-02-02 16:01:10 +01:00
{{ .Content }}
</div>
2024-03-04 08:05:53 +01:00
</article>
2024-04-09 14:03:09 +02:00
{{ $readNextPosts := 3}}
{{ if isset .Site.Params "readnextposts" }}
{{ $readNextPosts = .Site.Params.readNextPosts }}
{{ end }}
{{ if gt $readNextPosts 0 }}
{{ $related := .Site.RegularPages.Related . | first $readNextPosts }}
2022-02-18 10:29:49 +01:00
{{ with $related }}
2024-03-04 12:34:27 +01:00
<h3 class="read-next-title noselect">{{ i18n "readNext" }}</h3>
<ul class="read-next-posts noselect">
2022-02-18 10:29:49 +01:00
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ end }}
2020-06-24 21:21:59 +02:00
{{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }}
2021-07-09 18:00:52 +02:00
{{ partial "post-pagination.html" . }}
{{ end }}
2022-04-12 19:11:58 +02:00
{{ if not .Params.disableComments }}
{{ partial "comments.html" . }}
2020-01-21 19:57:57 +01:00
{{ end }}
2024-04-09 14:03:09 +02:00
{{/* When you use ```mermaid``, render-codeblock-mermaid.html is called and
2024-04-09 09:20:53 +02:00
`.Store.Set "hasMermaid"` is executed.
`.Store.Get "hasMermaid"` will return true and mermaid.js will be loaded.
*/}}
2024-04-09 14:03:09 +02:00
2024-04-09 09:20:53 +02:00
{{ if .Store.Get "hasMermaid" }}
2024-04-09 10:42:47 +02:00
{{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/load-mermaid.js") }}
2024-04-09 14:03:09 +02:00
2024-04-09 10:42:47 +02:00
{{ $colorTheme := "light" }}
{{ if and (isset site.Params "colortheme") (ne site.Params.colortheme "") }}
{{ $colorTheme = site.Params.colortheme | lower }}
{{ end }}
2024-04-09 09:20:53 +02:00
<script type="module">
2024-04-09 10:42:47 +02:00
function detectCurrentScheme3() {
const defaultTheme = "{{ $colorTheme }}";
if (localStorage !== null && localStorage.getItem("user-color-scheme")) {
return localStorage.getItem("user-color-scheme");
}
if (defaultTheme === "dark" || defaultTheme === "light") {
return defaultTheme;
}
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
}
2024-04-09 14:03:09 +02:00
2024-04-09 09:20:53 +02:00
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
2024-04-09 10:42:47 +02:00
window.mermaid = mermaid;
window.initMermaid()
document.body.dispatchEvent(new CustomEvent(detectCurrentScheme3() + "-theme-set"));
2024-04-09 09:20:53 +02:00
</script>
{{ end }}
{{ end }}