Merge branch 'master' of https://github.com/Mitrichius/hugo-theme-anubis into add-isso-feed
This commit is contained in:
commit
f8c6877c16
52 changed files with 790 additions and 162 deletions
15
layouts/partials/comments.html
Normal file
15
layouts/partials/comments.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{{ if .Site.DisqusShortname }}
|
||||
{{ partial "disqus.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.UtterancesRepo }}
|
||||
{{ partial "utterances.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.isso.enabled }}
|
||||
{{ partial "isso.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.graphcommentId }}
|
||||
{{ partial "graphcomment.html" . }}
|
||||
{{ end }}
|
1
layouts/partials/fa-icons/rss.svg
Normal file
1
layouts/partials/fa-icons/rss.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"/></svg>
|
After Width: | Height: | Size: 903 B |
|
@ -15,7 +15,7 @@
|
|||
{{ end }}
|
||||
<div class="copyright">
|
||||
<p>© {{ if isset .Site.Params "author"}}{{ .Site.Params.author }}, {{end}}{{ now.Year }}<br>
|
||||
{{ i18n "powered" | humanize }} <a target="_blank" rel="noopener noreferrer" href="https://gohugo.io/">Hugo</a>, {{ i18n "theme" }} <a target="_blank" rel="noopener noreferrer" href="https://github.com/mitrichius/hugo-theme-anubis">Anubis</a>.<br>
|
||||
{{ i18n "powered" }} <a target="_blank" rel="noopener noreferrer" href="https://gohugo.io/">Hugo</a>, {{ i18n "theme" }} <a target="_blank" rel="noopener noreferrer" href="https://github.com/mitrichius/hugo-theme-anubis">Anubis</a>.<br>
|
||||
{{ partial "footer-extra.html" . }}
|
||||
</p>
|
||||
</div>
|
||||
|
|
32
layouts/partials/graphcomment.html
Normal file
32
layouts/partials/graphcomment.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<div id="graphcomment"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
/* - - - CONFIGURATION VARIABLES - - - */
|
||||
|
||||
var __semio__params = {
|
||||
graphcommentId: "{{ .Site.Params.graphcommentId }}", // obviously you need to create your own ID on graphcomment.com
|
||||
|
||||
behaviour: {
|
||||
// HIGHLY RECOMMENDED
|
||||
// uid: "...", // uniq identifer for the comments thread on your page (ex: your page id)
|
||||
},
|
||||
|
||||
// configure your variables here
|
||||
|
||||
}
|
||||
|
||||
/* - - - DON'T EDIT BELOW THIS LINE - - - */
|
||||
|
||||
function __semio__onload() {
|
||||
__semio__gc_graphlogin(__semio__params)
|
||||
}
|
||||
|
||||
|
||||
(function() {
|
||||
var gc = document.createElement('script'); gc.type = 'text/javascript'; gc.async = true;
|
||||
gc.onload = __semio__onload; gc.defer = true; gc.src = 'https://integration.graphcomment.com/gc_graphlogin.js?' + Date.now();
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(gc);
|
||||
})();
|
||||
|
||||
|
||||
</script>
|
|
@ -7,13 +7,42 @@
|
|||
{{ partial "title.html" . }}
|
||||
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}">
|
||||
|
||||
{{ with .Keywords }}
|
||||
<meta name="keywords" content="{{ range $i, $e := . }}{{ if $i }},{{ end }}{{ $e }}{{ end }}">
|
||||
{{ end }}
|
||||
|
||||
{{ if and (.IsPage) (eq .Params.hidden true)}}
|
||||
<meta name="robots" content="noindex" />
|
||||
{{ end }}
|
||||
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
|
||||
{{ partial "favicons.html" . }}
|
||||
|
||||
<style>
|
||||
body {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<noscript>
|
||||
<style>
|
||||
body {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
</noscript>
|
||||
|
||||
{{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/main.css") }}
|
||||
|
||||
{{ if .Site.Params.copyCodeButton | default true }}
|
||||
{{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/copy-code.js") }}
|
||||
{{ end }}
|
||||
|
||||
{{ range .Site.Params.customJS -}}
|
||||
{{ partial "resource.html" (dict "context" $ "type" "js" "filename" . ) }}
|
||||
{{- end }}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<div class="header-top">
|
||||
<h1 class="site-title">
|
||||
<a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a>
|
||||
</h1>
|
||||
{{ partial "site-title.html" . }}
|
||||
{{ partial "social.html" . }}
|
||||
</div>
|
||||
{{ if .Site.Menus.main }}
|
||||
|
|
|
@ -15,15 +15,17 @@
|
|||
<div class="post-taxonomies">
|
||||
{{ if .Params.categories }}
|
||||
<ul class="post-categories">
|
||||
{{ range .Params.categories }}
|
||||
<li><a href="{{ "categories/" | absLangURL }}{{ . | urlize }}">{{ . }}</a></li>
|
||||
{{ range $cat_name := .Params.categories }}
|
||||
{{ $cat := ($.Site.GetPage (printf "/categories/%s" $cat_name)) }}
|
||||
<li><a href="{{ $cat.Permalink }}">{{ $cat.Title | default $cat_name }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ if .Params.tags }}
|
||||
<ul class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
<li><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">#{{ . }}</a></li>
|
||||
{{ range $tag_name := .Params.tags }}
|
||||
{{ $tag := ($.Site.GetPage (printf "/tags/%s" $tag_name)) }}
|
||||
<li><a href="{{ $tag.Permalink }}">#{{ $tag.Title | default $tag_name }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{{ end }}
|
||||
{{ if and (.Truncated) (.Site.Params.readMore) }}
|
||||
<div class="read-more">
|
||||
<a class="u-url" href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
|
||||
<a class="u-url" href="{{ .RelPermalink }}">{{ i18n "readMore" }}</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
|
3
layouts/partials/site-title.html
Normal file
3
layouts/partials/site-title.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h1 class="site-title">
|
||||
<a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a>
|
||||
</h1>
|
|
@ -23,4 +23,15 @@
|
|||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ if .Site.Params.rssAsSocialIcon }}
|
||||
{{ with .Site.Home.OutputFormats.Get "rss" -}}
|
||||
<li>
|
||||
<a {{ printf "href=%q" .Permalink | safeHTMLAttr }} title="RSS" rel="me">
|
||||
{{ partial "font-awesome.html" (dict "iconName" "rss" "custom" false) }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
|
||||
</ul>
|
|
@ -5,69 +5,81 @@
|
|||
|
||||
{{ if not (in (slice "light-without-switcher" "dark-without-switcher" "auto-without-switcher") $style) }}
|
||||
<button class="theme-switcher">
|
||||
{{ i18n "darkTheme" | humanize }}
|
||||
{{ i18n "darkTheme" }}
|
||||
</button>
|
||||
{{ end }}
|
||||
|
||||
<script>
|
||||
const STORAGE_KEY = 'user-color-scheme'
|
||||
const defaultTheme = {{ $style }}
|
||||
<script>
|
||||
const STORAGE_KEY = 'user-color-scheme'
|
||||
const defaultTheme = {{ $style }}
|
||||
|
||||
let currentTheme
|
||||
let switchButton
|
||||
let autoDefinedScheme = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
let currentTheme
|
||||
let switchButton
|
||||
let autoDefinedScheme = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
|
||||
const autoChangeScheme = e => {
|
||||
currentTheme = e.matches ? 'dark' : 'light'
|
||||
document.documentElement.setAttribute('data-theme', currentTheme)
|
||||
changeButtonText()
|
||||
const autoChangeScheme = e => {
|
||||
currentTheme = e.matches ? 'dark' : 'light'
|
||||
document.documentElement.setAttribute('data-theme', currentTheme)
|
||||
changeButtonText()
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
switchButton = document.querySelector('.theme-switcher')
|
||||
currentTheme = detectCurrentScheme()
|
||||
if (currentTheme == 'dark') {
|
||||
document.documentElement.setAttribute('data-theme', 'dark')
|
||||
}
|
||||
if (currentTheme == 'auto') {
|
||||
autoChangeScheme(autoDefinedScheme);
|
||||
autoDefinedScheme.addListener(autoChangeScheme);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
switchButton = document.querySelector('.theme-switcher')
|
||||
currentTheme = detectCurrentScheme()
|
||||
if (currentTheme == 'dark') {
|
||||
document.documentElement.setAttribute('data-theme', 'dark')
|
||||
}
|
||||
if (currentTheme == 'auto') {
|
||||
autoChangeScheme(autoDefinedScheme);
|
||||
autoDefinedScheme.addListener(autoChangeScheme);
|
||||
}
|
||||
if (switchButton) {
|
||||
changeButtonText()
|
||||
switchButton.addEventListener('click', switchTheme, false)
|
||||
})
|
||||
}
|
||||
|
||||
showContent()
|
||||
})
|
||||
|
||||
function detectCurrentScheme() {
|
||||
if (localStorage.getItem(STORAGE_KEY)) {
|
||||
return localStorage.getItem(STORAGE_KEY)
|
||||
}
|
||||
if (defaultTheme) {
|
||||
return defaultTheme
|
||||
}
|
||||
if (!window.matchMedia) {
|
||||
return 'light'
|
||||
}
|
||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
return 'dark'
|
||||
}
|
||||
function detectCurrentScheme() {
|
||||
if (localStorage.getItem(STORAGE_KEY)) {
|
||||
return localStorage.getItem(STORAGE_KEY)
|
||||
}
|
||||
if (defaultTheme) {
|
||||
return defaultTheme
|
||||
}
|
||||
if (!window.matchMedia) {
|
||||
return 'light'
|
||||
}
|
||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
return 'dark'
|
||||
}
|
||||
return 'light'
|
||||
}
|
||||
|
||||
function changeButtonText()
|
||||
{
|
||||
switchButton.textContent = currentTheme == 'dark' ? {{ i18n "lightTheme" | humanize }} : {{ i18n "darkTheme" | humanize }}
|
||||
function changeButtonText()
|
||||
{
|
||||
if (switchButton) {
|
||||
switchButton.textContent = currentTheme == 'dark' ? {{ i18n "lightTheme" }} : {{ i18n "darkTheme" }}
|
||||
}
|
||||
}
|
||||
|
||||
function switchTheme(e) {
|
||||
if (currentTheme == 'dark') {
|
||||
localStorage.setItem(STORAGE_KEY, 'light')
|
||||
document.documentElement.setAttribute('data-theme', 'light')
|
||||
currentTheme = 'light'
|
||||
} else {
|
||||
localStorage.setItem(STORAGE_KEY, 'dark')
|
||||
document.documentElement.setAttribute('data-theme', 'dark')
|
||||
currentTheme = 'dark'
|
||||
}
|
||||
changeButtonText()
|
||||
function switchTheme(e) {
|
||||
if (currentTheme == 'dark') {
|
||||
localStorage.setItem(STORAGE_KEY, 'light')
|
||||
document.documentElement.setAttribute('data-theme', 'light')
|
||||
currentTheme = 'light'
|
||||
} else {
|
||||
localStorage.setItem(STORAGE_KEY, 'dark')
|
||||
document.documentElement.setAttribute('data-theme', 'dark')
|
||||
currentTheme = 'dark'
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
changeButtonText()
|
||||
}
|
||||
|
||||
function showContent() {
|
||||
document.body.style.visibility = 'visible';
|
||||
document.body.style.opacity = 1;
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue