standarize configuration
This commit is contained in:
parent
e4522e429a
commit
37351acf91
17 changed files with 150 additions and 108 deletions
|
@ -0,0 +1,6 @@
|
|||
{{ define "main" }}
|
||||
<main class="container mx-auto">
|
||||
<h1 class="text-5xl font-bold">Oops!</h1>
|
||||
<p>404 Not Found</p>
|
||||
</main>
|
||||
{{ end }}
|
67
layouts/partials/comment.html
Normal file
67
layouts/partials/comment.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
<!-- slot -->
|
||||
<div id="comment"></div>
|
||||
|
||||
<!-- Giscus -->
|
||||
{{ if eq .Site.Params.comment.provider "giscus" }}
|
||||
{{ with .Site.Params.comment.giscus }}
|
||||
<script>
|
||||
const s = document.createElement("script")
|
||||
s.src = "https://giscus.app/client.js"
|
||||
s.crossOrigin = "anonymous"
|
||||
s.async = true
|
||||
s.setAttribute("data-repo", "{{ .repo }}")
|
||||
s.setAttribute("data-repo-id", "{{ .repoId }}")
|
||||
s.setAttribute("data-category", "{{ .category }}")
|
||||
s.setAttribute("data-category-id", "{{ .categoryId }}")
|
||||
s.setAttribute("data-mapping", "{{ .mapping }}")
|
||||
s.setAttribute("data-strict", "0")
|
||||
s.setAttribute("data-reactions-enabled", "{{ cond .reactions 1 0 }}")
|
||||
s.setAttribute("data-emit-metadata", "{{ cond .metadata 1 0 }}")
|
||||
s.setAttribute("data-input-position", "{{ .inputPosition }}")
|
||||
s.setAttribute("data-theme", window.minima_theme + "_protanopia")
|
||||
s.setAttribute("data-lang", "en")
|
||||
s.setAttribute("data-loading", "lazy")
|
||||
document.getElementById("comment").appendChild(s)
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Utterances -->
|
||||
{{ if eq .Site.Params.comment.provider "utterances" }}
|
||||
{{ with .Site.Params.comment.utterances }}
|
||||
<script>
|
||||
const s = document.createElement("script")
|
||||
s.src = "https://utteranc.es/client.js"
|
||||
s.crossOrigin = "anonymous"
|
||||
s.async = true
|
||||
s.setAttribute("repo", "{{ .repo }}")
|
||||
s.setAttribute("issue-term", "{{ .issueTerm }}")
|
||||
s.setAttribute("label", "{{ .label }}")
|
||||
s.setAttribute("theme", "github-" + window.minima_theme)
|
||||
document.getElementById("comment").appendChild(s)
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Disqus -->
|
||||
{{ if eq .Site.Params.comment.provider "disqus" }}
|
||||
{{ with .Site.Params.comment.disqus }}
|
||||
<div id="disqus_thread" class="mt-8 mb-8"></div>
|
||||
<script type="text/javascript">
|
||||
// Don't ever inject Disqus on localhost--it creates unwanted
|
||||
// discussions from 'localhost:1313' on your Disqus account...
|
||||
if (window.location.hostname == "localhost")
|
||||
return;
|
||||
|
||||
const dsq = document.createElement('script');
|
||||
dsq.type = 'text/javascript';
|
||||
dsq.async = true;
|
||||
|
||||
const disqus_shortname = '{{ .shortname }}';
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
document.getElementById("comment").appendChild(dsq);
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by
|
||||
Disqus.</a></noscript>
|
||||
{{ end }}
|
||||
{{ end }}
|
|
@ -1,7 +1,9 @@
|
|||
{{ if eq .Site.Params.diagram.provider "mermaid" }}
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
<script>
|
||||
mermaid.init(undefined, 'code.language-mermaid')
|
||||
</script>
|
||||
</script>
|
||||
{{ end }}
|
|
@ -1,16 +0,0 @@
|
|||
<div id="disqus_thread" class="mt-8 mb-8"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
// Don't ever inject Disqus on localhost--it creates unwanted
|
||||
// discussions from 'localhost:1313' on your Disqus account...
|
||||
if (window.location.hostname == "localhost")
|
||||
return;
|
||||
|
||||
const dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
const disqus_shortname = '{{ .Site.Params.shortname }}';
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by
|
||||
Disqus.</a></noscript>
|
|
@ -1,18 +0,0 @@
|
|||
{{ $giscus := .Site.Params.comment.giscus }}
|
||||
<script
|
||||
src="https://giscus.app/client.js"
|
||||
data-repo="{{ $giscus.repo }}"
|
||||
data-repo-id="{{ $giscus.repoId }}"
|
||||
data-category="{{ $giscus.category }}"
|
||||
data-category-id="{{ $giscus.categoryId }}"
|
||||
data-mapping="{{ $giscus.mapping }}"
|
||||
data-strict="0"
|
||||
data-reactions-enabled="{{ cond $giscus.reactions 1 0 }}"
|
||||
data-emit-metadata="{{ cond $giscus.metadata 1 0 }}"
|
||||
data-input-position="{{ $giscus.inputPosition }}"
|
||||
data-theme="preferred_color_scheme"
|
||||
data-lang="en"
|
||||
data-loading="lazy"
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
|
@ -30,11 +30,16 @@
|
|||
</head>
|
||||
<script>
|
||||
// default to system color scheme.
|
||||
let systemColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
let default_theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
|
||||
try {
|
||||
document.querySelector('html').classList.add(systemColorScheme);
|
||||
localStorage.setItem('theme', systemColorScheme);
|
||||
const local = localStorage.getItem('theme')
|
||||
if (local) {
|
||||
default_theme = local
|
||||
}
|
||||
localStorage.setItem('theme', default_theme);
|
||||
window.minima_theme = default_theme;
|
||||
document.querySelector('html').classList.add(default_theme);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css"
|
||||
integrity="sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc" crossorigin="anonymous">
|
||||
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.js"
|
||||
integrity="sha384-YNHdsYkH6gMx9y3mRkmcJ2mFUjTd0qNQQvY9VYZgQd7DcN7env35GzlmFaZ23JGp" crossorigin="anonymous"></script>
|
||||
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/contrib/auto-render.min.js"
|
||||
integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
renderMathInElement(document.body, {
|
||||
// customised options
|
||||
// • auto-render specific keys, e.g.:
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: true },
|
||||
{ left: '$', right: '$', display: false },
|
||||
{ left: '\\(', right: '\\)', display: false },
|
||||
{ left: '\\[', right: '\\]', display: true }
|
||||
],
|
||||
// • rendering keys, e.g.:
|
||||
throwOnError: false
|
||||
});
|
||||
});
|
||||
</script>
|
29
layouts/partials/math.html
Normal file
29
layouts/partials/math.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
{{ if eq .Site.Params.math.provider "katex" }}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css"
|
||||
integrity="sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc" crossorigin="anonymous">
|
||||
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.js"
|
||||
integrity="sha384-YNHdsYkH6gMx9y3mRkmcJ2mFUjTd0qNQQvY9VYZgQd7DcN7env35GzlmFaZ23JGp"
|
||||
crossorigin="anonymous"></script>
|
||||
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/contrib/auto-render.min.js"
|
||||
integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl"
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
renderMathInElement(document.body, {
|
||||
// customised options
|
||||
// • auto-render specific keys, e.g.:
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: true },
|
||||
{ left: '$', right: '$', display: false },
|
||||
{ left: '\\(', right: '\\)', display: false },
|
||||
{ left: '\\[', right: '\\]', display: true }
|
||||
],
|
||||
// • rendering keys, e.g.:
|
||||
throwOnError: false
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
|
@ -1,27 +1,11 @@
|
|||
<script>
|
||||
window.minima_theme = localStorage.getItem('theme')
|
||||
</script>
|
||||
|
||||
{{ if or .Params.math .Site.Params.math }}
|
||||
{{ partial "katex.html" . }}
|
||||
{{ if or .Params.math (and .Site.Params.math.enable (ne .Params.math false)) }}
|
||||
{{ partial "math.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if or .Params.mermaid .Site.Params.mermaid }}
|
||||
{{ partial "mermaid.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if or .Params.comment (and .Site.Params.commentOnAllPosts (ne .Params.comment false)) }}
|
||||
|
||||
{{ if eq .Site.Params.comment.provider "disqus"}}
|
||||
{{ partial "disqus.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .Site.Params.comment.provider "giscus" }}
|
||||
{{ partial "giscus.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .Site.Params.comment.provider "utterances"}}
|
||||
{{ partial "utterances.html" . }}
|
||||
{{ if or .Params.diagram (and .Site.Params.diagram.enable (ne .Params.diagram false)) }}
|
||||
{{ partial "diagram.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if or .Params.comment (and .Site.Params.comment.enable (ne .Params.comment false)) }}
|
||||
{{ partial "comment.html" . }}
|
||||
{{ end }}
|
|
@ -1,8 +0,0 @@
|
|||
<script src="https://utteranc.es/client.js"
|
||||
repo="{{ .Site.Params.utterances.repo }}"
|
||||
issue-term="{{ .Site.Params.utterances.issueTerm }}"
|
||||
label="{{ .Site.Params.utterances.label }}"
|
||||
theme="preferred-color-scheme"
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue