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
8
layouts/404.html
Normal file
8
layouts/404.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{{ define "main"}}
|
||||
<main id="main">
|
||||
<div>
|
||||
<h1 id="title"><a href="{{ .Site.BaseURL | relLangURL }}">Go Home</a></h1>
|
||||
Sorry, this Page is not available.
|
||||
</div>
|
||||
</main>
|
||||
{{ end }}
|
7
layouts/_default/_markup/render-heading.html
Normal file
7
layouts/_default/_markup/render-heading.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<h{{ .Level }} id="{{ .Anchor | safeURL }}" {{ if .Attributes.style }}style="{{ .Attributes.style | safeCSS }}"{{ end }}>{{ .Text | safeHTML }}
|
||||
<span>
|
||||
<a href="#{{ .Anchor }}">
|
||||
<svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/></svg>
|
||||
</a>
|
||||
</span>
|
||||
</h{{ .Level }}>
|
|
@ -10,7 +10,7 @@
|
|||
{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
<a class="skip-main" href="#main">{{ i18n "skipToContent" | humanize }}</a>
|
||||
<a class="skip-main" href="#main">{{ i18n "skipToContent" }}</a>
|
||||
<div class="container">
|
||||
<header class="common-header">
|
||||
{{ block "header" . }}
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
<div class="articles h-feed">
|
||||
<h1 class="post-title">{{ i18n .Title }}</h1>
|
||||
{{ $pages := where .Pages "Type" "in" site.Params.mainSections }}
|
||||
{{ $pages := where (where .Pages "Type" "in" site.Params.mainSections) "Params.hidden" "!=" true}}
|
||||
{{ range $pages }}
|
||||
<div class="post-short-list h-entry">
|
||||
<div class="post-header">
|
||||
<header>
|
||||
<header>
|
||||
<h2 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h2>
|
||||
{{ partial "post-language-switcher.html" . }}
|
||||
</header>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := where $pctx.RegularPages ".Params.disable_feed" "!=" true -}}
|
||||
{{- $pages := where (where $pctx.RegularPages ".Params.disable_feed" "!=" true) "Params.hidden" "!=" true -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{{ if .Menus }}
|
||||
<nav class="post-navigation">
|
||||
{{ range .Menus }}
|
||||
<a href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
<a href="{{ .ConfiguredURL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ end }}
|
||||
|
@ -21,20 +21,23 @@
|
|||
{{ partial "post-info.html" . }}
|
||||
</article>
|
||||
|
||||
{{ if gt .Site.Params.readNextPosts 0 }}
|
||||
{{ $related := .Site.RegularPages.Related . | first .Site.Params.readNextPosts }}
|
||||
{{ with $related }}
|
||||
<h3 class="read-next-title">{{ i18n "readNext" }}</h3>
|
||||
<ul class="read-next-posts">
|
||||
{{ range . }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }}
|
||||
{{ partial "post-pagination.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.DisqusShortname }}
|
||||
{{ partial "disqus.html" . }}
|
||||
{{ if not .Params.disableComments }}
|
||||
{{ partial "comments.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.UtterancesRepo }}
|
||||
{{ partial "utterances.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.isso.enabled }}
|
||||
{{ partial "isso.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<div class="post-info">
|
||||
<a href="{{ (print .Data.Plural "/") | relLangURL }}">{{ i18n (printf "toAll%s" (.Data.Plural | humanize )) | humanize }}</a>
|
||||
</div>
|
||||
{{ range .Paginator.Pages }}
|
||||
{{ $pages := where .Pages "Params.hidden" "!=" true }}
|
||||
{{ range (.Paginate $pages).Pages }}
|
||||
{{ partial "post-summary.html" . }}
|
||||
{{ end }}
|
||||
{{ partial "pagination.html" . }}
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
</div>
|
||||
|
||||
<h1>{{ i18n .Title }}</h1>
|
||||
|
||||
<ul class="terms">
|
||||
{{ range $key, $value := .Data.Terms }}
|
||||
<li>
|
||||
<a href="{{ (print $.Data.Plural "/" (lower $key)) | absLangURL }}">
|
||||
{{ $key }}
|
||||
</a>
|
||||
({{ len $value }})
|
||||
</li>
|
||||
{{ range .Data.Terms }}
|
||||
{{ $postsNum := len (where .Pages "Params.hidden" "!=" true) }}
|
||||
{{ if gt $postsNum 0 }}
|
||||
<li>
|
||||
<a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a>
|
||||
({{ $postsNum }})
|
||||
</li>
|
||||
{{ end}}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</div>
|
||||
|
||||
<div class="articles h-feed">
|
||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
{{ $pages := where (where site.RegularPages "Type" "in" site.Params.mainSections) "Params.hidden" "!=" true }}
|
||||
{{ range (.Paginate $pages).Pages }}
|
||||
{{ partial "post-summary.html" . }}
|
||||
{{ end }}
|
||||
|
|
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