initial
This commit is contained in:
28
blog/themes/anubis/layouts/_default/baseof.html
Normal file
28
blog/themes/anubis/layouts/_default/baseof.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
{{ $dataTheme := "" }}
|
||||
{{ if eq site.Params.style "dark-without-switcher" }}
|
||||
{{ $dataTheme = "dark" }}
|
||||
{{ end }}
|
||||
<html lang="{{ .Site.LanguageCode }}" data-theme="{{ $dataTheme }}">
|
||||
<head>
|
||||
{{ block "head" . }}
|
||||
{{ partial "head.html" . }}
|
||||
{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
<a class="skip-main" href="#main">{{ i18n "skipToContent" | humanize }}</a>
|
||||
<div class="container">
|
||||
<header class="common-header">
|
||||
{{ block "header" . }}
|
||||
{{ partial "header.html" . }}
|
||||
{{ end }}
|
||||
</header>
|
||||
<main id="main" tabindex="-1">
|
||||
{{ block "main" . }}{{ end }}
|
||||
</main>
|
||||
{{ block "footer" . }}
|
||||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
20
blog/themes/anubis/layouts/_default/list.html
Normal file
20
blog/themes/anubis/layouts/_default/list.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{ define "main" }}
|
||||
<div class="index-content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
<div class="articles h-feed">
|
||||
<h1 class="post-title">{{ i18n .Title }}</h1>
|
||||
{{ $pages := where .Pages "Type" "in" site.Params.mainSections }}
|
||||
{{ range $pages }}
|
||||
<div class="post-short-list h-entry">
|
||||
<header class="post-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>
|
||||
{{ partial "post-info.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
34
blog/themes/anubis/layouts/_default/rss.xml
Normal file
34
blog/themes/anubis/layouts/_default/rss.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := where $pctx.RegularPages ".Params.disable_feed" "!=" true -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>{{ .Site.Title }}{{ if ne .Title .Site.Title }}{{ with .Title }} ({{.}}){{ end }}{{ end }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{ with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{ range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Content | html }}</description>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
||||
34
blog/themes/anubis/layouts/_default/single.html
Normal file
34
blog/themes/anubis/layouts/_default/single.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{{ define "main" }}
|
||||
{{ if .Menus }}
|
||||
<nav class="post-navigation">
|
||||
{{ range .Menus }}
|
||||
<a href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ end }}
|
||||
|
||||
<article class="post h-entry">
|
||||
<header class="post-header">
|
||||
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}">{{ trim .Title " " }}</h1>
|
||||
|
||||
{{ partial "post-language-switcher.html" . }}
|
||||
</header>
|
||||
<div class="content e-content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
{{ partial "post-info.html" . }}
|
||||
</article>
|
||||
|
||||
{{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }}
|
||||
{{ partial "post-pagination.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.DisqusShortname }}
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.UtterancesRepo }}
|
||||
{{ partial "utterances.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
11
blog/themes/anubis/layouts/_default/taxonomy.html
Normal file
11
blog/themes/anubis/layouts/_default/taxonomy.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{ define "main" }}
|
||||
<h1>{{ i18n .Data.Singular | humanize }}: {{ .Title }}</h1>
|
||||
<div class="post-info">
|
||||
<a href="{{ (printf "%s/%s" .Site.LanguagePrefix .Data.Plural) | absLangURL }}">{{ i18n (printf "toAll%s" (.Data.Plural | humanize )) | humanize }}</a>
|
||||
</div>
|
||||
{{ range .Paginator.Pages }}
|
||||
{{ partial "post-summary.html" . }}
|
||||
{{ end }}
|
||||
{{ partial "pagination.html" . }}
|
||||
|
||||
{{ end }}
|
||||
19
blog/themes/anubis/layouts/_default/terms.html
Normal file
19
blog/themes/anubis/layouts/_default/terms.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{{ define "main" }}
|
||||
<div class="index-content">
|
||||
{{ .Content }}
|
||||
</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>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ end }}
|
||||
14
blog/themes/anubis/layouts/index.html
Normal file
14
blog/themes/anubis/layouts/index.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{ define "main" }}
|
||||
<div class="homepage-content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
<div class="articles h-feed">
|
||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
{{ range (.Paginate $pages).Pages }}
|
||||
{{ partial "post-summary.html" . }}
|
||||
{{ end }}
|
||||
{{ partial "pagination.html" . }}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
15
blog/themes/anubis/layouts/partials/font-awesome.html
Normal file
15
blog/themes/anubis/layouts/partials/font-awesome.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<span class="inline-svg" >
|
||||
|
||||
{{ $dict := newScratch }}
|
||||
|
||||
{{ if (eq .custom true) }}
|
||||
{{ $dict.Set "filename" (print "static/fa-icons/" .iconName ".svg") }}
|
||||
{{ else }}
|
||||
{{ $dict.Set "filename" (print "themes/anubis/static/fa-icons/" .iconName ".svg") }}
|
||||
{{ end }}
|
||||
|
||||
{{- $path:="<path" -}}
|
||||
{{- $fill:="<path fill=\"currentColor\"" -}}
|
||||
{{ replace (readFile ($dict.Get "filename")) $path $fill | safeHTML }}
|
||||
|
||||
</span>
|
||||
1
blog/themes/anubis/layouts/partials/footer-extra.html
Normal file
1
blog/themes/anubis/layouts/partials/footer-extra.html
Normal file
@@ -0,0 +1 @@
|
||||
<!--for overriding-->
|
||||
27
blog/themes/anubis/layouts/partials/footer.html
Normal file
27
blog/themes/anubis/layouts/partials/footer.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<footer class="common-footer">
|
||||
{{ $languagesCount := $.Site.Home.AllTranslations }}
|
||||
{{ if gt $languagesCount 1 }}
|
||||
{{ partial "language-switcher.html" . }}
|
||||
{{ end }}
|
||||
|
||||
<div class="common-footer-bottom">
|
||||
{{ if .Site.Menus.footer }}
|
||||
{{ $currentPage := . }}
|
||||
<ul class="footer-menu">
|
||||
{{ range .Site.Menus.footer }}
|
||||
<li><a class="{{if or ($currentPage.IsMenuCurrent "footer" .) ($currentPage.HasMenuCurrent "footer" .) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ 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>
|
||||
{{ partial "footer-extra.html" . }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{ partial "theme-switcher.html" . }}
|
||||
</div>
|
||||
|
||||
{{ partial "h-card.html" . }}
|
||||
</footer>
|
||||
13
blog/themes/anubis/layouts/partials/h-card.html
Normal file
13
blog/themes/anubis/layouts/partials/h-card.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<p class="h-card vcard">
|
||||
|
||||
<a href={{ .Site.BaseURL }} class="p-name u-url url fn" rel="me">{{ .Site.Params.author }}</a>
|
||||
|
||||
{{ if .Site.Params.email }}
|
||||
/
|
||||
<a class="p-email u-email email" rel="me" href="mailto:{{ .Site.Params.email }}">{{ .Site.Params.email }}</a>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.avatar }}
|
||||
<img class="u-photo" src="{{ .Site.Params.avatar }}" />
|
||||
{{ end }}
|
||||
</p>
|
||||
1
blog/themes/anubis/layouts/partials/head-extra.html
Normal file
1
blog/themes/anubis/layouts/partials/head-extra.html
Normal file
@@ -0,0 +1 @@
|
||||
<!--for overriding-->
|
||||
48
blog/themes/anubis/layouts/partials/head.html
Normal file
48
blog/themes/anubis/layouts/partials/head.html
Normal file
@@ -0,0 +1,48 @@
|
||||
<!-- Basic stuff -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="HandheldFriendly" content="True">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer-when-downgrade">
|
||||
|
||||
<title>{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
|
||||
<meta name="description" content="{{ .Site.Params.Description }}">
|
||||
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="{{ "favicon.ico" | absURL }}">
|
||||
<link rel="apple-touch-icon-precomposed" href="{{ "favicon.png" | absURL }}">
|
||||
|
||||
{{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/main.css") }}
|
||||
|
||||
{{ range .Site.Params.customJS -}}
|
||||
{{ partial "resource.html" (dict "context" $ "type" "js" "filename" . ) }}
|
||||
{{- end }}
|
||||
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
|
||||
{{ if isset .Site.Params "webmentions" }}
|
||||
{{ if isset .Site.Params.webmentions "login" }}
|
||||
<link rel="webmention" href="https://webmention.io/{{.Site.Params.webmentions.login}}/webmention" />
|
||||
{{ if eq .Site.Params.webmentions.pingback true }}
|
||||
<link rel="pingback" href="https://webmention.io/{{.Site.Params.webmentions.login}}/xmlrpc" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if isset .Site.Params.webmentions "url" }}
|
||||
<link rel="webmention" href="{{.Site.Params.webmentions.url}}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Article tags -->
|
||||
<!-- <meta property="article:published_time" content="">
|
||||
<meta property="article:modified_time" content="">
|
||||
<meta property="article:tag" content="">
|
||||
<meta property="article:publisher" content="https://www.facebook.com/XXX"> -->
|
||||
|
||||
{{ if and (.Site.GoogleAnalytics) (or (eq (getenv "HUGO_ENV") "production") (eq .Site.Params.env "production")) }}
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "head-extra.html" . }}
|
||||
1
blog/themes/anubis/layouts/partials/header-extra.html
Normal file
1
blog/themes/anubis/layouts/partials/header-extra.html
Normal file
@@ -0,0 +1 @@
|
||||
<!--for overriding-->
|
||||
18
blog/themes/anubis/layouts/partials/header.html
Normal file
18
blog/themes/anubis/layouts/partials/header.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<div class="header-top">
|
||||
<h1 class="site-title">
|
||||
<a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a>
|
||||
</h1>
|
||||
{{ partial "social.html" . }}
|
||||
</div>
|
||||
{{ if .Site.Menus.main }}
|
||||
<nav>
|
||||
{{ $currentPage := . }}
|
||||
{{ range .Site.Menus.main }}
|
||||
<a class="{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ else }}
|
||||
<nav></nav>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "header-extra.html" . }}
|
||||
@@ -0,0 +1,5 @@
|
||||
<ul class="language-select">
|
||||
{{ range $.Site.Home.AllTranslations }}
|
||||
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
@@ -0,0 +1 @@
|
||||
<!--for overriding-->
|
||||
16
blog/themes/anubis/layouts/partials/pagination.html
Normal file
16
blog/themes/anubis/layouts/partials/pagination.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ if or ( .Paginator.HasPrev ) ( .Paginator.HasNext ) }}
|
||||
{{ $toNewPostsMessage := i18n "toNewPosts" }}
|
||||
{{ $toOldPostsMessage := i18n "toOldPosts" }}
|
||||
<div class="pagination">
|
||||
<div class="left pagination-item {{ if not .Paginator.HasPrev }}disabled{{ end }}">
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<a href="{{ .Paginator.Prev.URL | relLangURL }}">{{ $toNewPostsMessage }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="right pagination-item {{ if not .Paginator.HasNext }}disabled{{ end }}">
|
||||
{{ if .Paginator.HasNext }}
|
||||
<a href="{{ .Paginator.Next.URL | relLangURL }}">{{ $toOldPostsMessage }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
31
blog/themes/anubis/layouts/partials/post-info.html
Normal file
31
blog/themes/anubis/layouts/partials/post-info.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{{ $dateFormat := "2006-01-02" }}
|
||||
{{ if .Site.Params.dateFormat }}
|
||||
{{ $dateFormat = .Site.Params.dateFormat }}
|
||||
{{ end }}
|
||||
|
||||
<div class="post-info">
|
||||
{{ if .Params.date }}
|
||||
<div class="post-date dt-published">{{ .Params.date.Format $dateFormat }}</div>
|
||||
{{ end }}
|
||||
|
||||
<a class="post-hidden-url u-url" href="{{ .Permalink }}">{{ .Permalink }}</a>
|
||||
<a href="{{ .Site.BaseURL }}" class="p-name p-author post-hidden-author h-card" rel="me">{{ .Params.author | default .Site.Params.author }}</a>
|
||||
|
||||
|
||||
<div class="post-taxonomies">
|
||||
{{ if .Params.categories }}
|
||||
<ul class="post-categories">
|
||||
{{ range .Params.categories }}
|
||||
<li><a href="{{ "/categories/" | urlize | absLangURL }}">{{ . }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ if .Params.tags }}
|
||||
<ul class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
<li><a href="{{ "/tags/" | absLangURL }}{{ . | urlize }}">#{{ . }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
{{ if .IsTranslated }}
|
||||
{{ $pageLang := .Page.Lang}}
|
||||
<ul class="post-translations">
|
||||
{{ range .AllTranslations }}
|
||||
{{ if eq .Lang $pageLang }}
|
||||
<li>
|
||||
{{ upper .Lang }}
|
||||
</li>
|
||||
{{ else }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ upper .Lang }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
16
blog/themes/anubis/layouts/partials/post-pagination.html
Normal file
16
blog/themes/anubis/layouts/partials/post-pagination.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ if or ( .PrevInSection ) ( .NextInSection ) }}
|
||||
<div class="pagination post-pagination">
|
||||
<div class="left pagination-item {{ if not .NextInSection }}disabled{{ end }}">
|
||||
{{ if .NextInSection }}
|
||||
<a href="{{ .NextInSection.Permalink | relLangURL }}">{{ .NextInSection.Title }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="right pagination-item {{ if not .PrevInSection }}disabled{{ end }}">
|
||||
{{ if .PrevInSection }}
|
||||
<a href="{{ .PrevInSection.Permalink | relLangURL }}">{{ .PrevInSection.Title }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination-extra.html" . }}
|
||||
19
blog/themes/anubis/layouts/partials/post-summary.html
Normal file
19
blog/themes/anubis/layouts/partials/post-summary.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<article class="post-list h-feed">
|
||||
<header class="post-header">
|
||||
<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h1>
|
||||
{{ partial "post-language-switcher.html" . }}
|
||||
</header>
|
||||
|
||||
{{ if not .Site.Params.disableSummary }}
|
||||
<div class="content post-summary p-summary">
|
||||
{{ .Summary | safeHTML }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if and (.Truncated) (.Site.Params.readMore) }}
|
||||
<div class="read-more">
|
||||
<a class="u-url" href="{{ .RelPermalink }}">{{ i18n "readMore" | humanize }}</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "post-info.html" . }}
|
||||
</article>
|
||||
29
blog/themes/anubis/layouts/partials/resource.html
Normal file
29
blog/themes/anubis/layouts/partials/resource.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{{ $targetFilename := "file" }}
|
||||
{{ if eq .type "css" }}
|
||||
{{ $targetFilename = "css/style.css"}}
|
||||
{{ else if eq .type "js" }}
|
||||
{{ $targetFilename = "js/script.js"}}
|
||||
{{ end }}
|
||||
|
||||
{{ $resource := resources.Get .filename }}
|
||||
|
||||
{{ if $resource }}
|
||||
{{ $resource := $resource | resources.ExecuteAsTemplate $targetFilename . }}
|
||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
|
||||
{{ $resource = $resource | resources.Minify }}
|
||||
{{ end }}
|
||||
{{ $resource = $resource | resources.Fingerprint "sha256" }}
|
||||
|
||||
{{ if eq .type "css" }}
|
||||
<link rel="stylesheet" href="{{ $resource.Permalink }}" integrity="{{ $resource.Data.Integrity }}">
|
||||
{{ else if eq .type "js" }}
|
||||
<script src="{{ $resource.Permalink }}" type="text/javascript" charset="utf-8" integrity="{{ $resource.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
<!-- For backward compatibility -->
|
||||
{{ else }}
|
||||
{{ if eq .type "css" }}
|
||||
<link rel="stylesheet" href="{{ .filename | absURL }}?rnd={{ now.Unix }}">
|
||||
{{ else if eq .type "js" }}
|
||||
<script src="{{ .filename | absURL }}?rnd={{ now.Unix }}" type="text/javascript" charset="utf-8"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
20
blog/themes/anubis/layouts/partials/social.html
Normal file
20
blog/themes/anubis/layouts/partials/social.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<ul class="social-icons">
|
||||
|
||||
{{ range $.Site.Params.Social }}
|
||||
{{ if and (isset $.Site.Data.social.social_icons .id) (isset . "name") }}
|
||||
{{ $url := index $.Site.Data.social.social_icons .id }}
|
||||
{{ $ref := printf $url .name }}
|
||||
<li>
|
||||
<a {{ printf "href=%q" $ref | safeHTMLAttr }} title="{{ humanize .id }}" rel="me">
|
||||
{{ partial "font-awesome.html" (dict "iconName" .id "custom" false) }}
|
||||
</a>
|
||||
</li>
|
||||
{{ else if (isset . "url") }}
|
||||
<li>
|
||||
<a href="{{ printf .url }}" title="{{ humanize .id }}" rel="me">
|
||||
{{ partial "font-awesome.html" (dict "iconName" .id "custom" true) }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
73
blog/themes/anubis/layouts/partials/theme-switcher.html
Normal file
73
blog/themes/anubis/layouts/partials/theme-switcher.html
Normal file
@@ -0,0 +1,73 @@
|
||||
{{ $style := "light-without-switcher" }}
|
||||
{{ if and (isset site.Params "style") (ne site.Params.style "") }}
|
||||
{{ $style = site.Params.style | lower }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not (in (slice "light-without-switcher" "dark-without-switcher" "auto-without-switcher") $style) }}
|
||||
<button class="theme-switcher">
|
||||
{{ i18n "darkTheme" | humanize }}
|
||||
</button>
|
||||
|
||||
<script>
|
||||
const STORAGE_KEY = 'user-color-scheme'
|
||||
const defaultTheme = {{ $style }}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
changeButtonText()
|
||||
switchButton.addEventListener('click', switchTheme, false)
|
||||
})
|
||||
|
||||
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 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()
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
11
blog/themes/anubis/layouts/partials/utterances.html
Normal file
11
blog/themes/anubis/layouts/partials/utterances.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{ $theme := .Site.Params.UtterancesTheme | default "github-light" }}
|
||||
{{ $label := .Site.Params.UtterancesLabel | default "" }}
|
||||
{{ $issue := .Site.Params.UtterancesIssue | default "url" }}
|
||||
<script src="https://utteranc.es/client.js"
|
||||
repo="{{- .Site.Params.UtterancesRepo -}}"
|
||||
theme="{{ $theme }}"
|
||||
label="{{ $label }}"
|
||||
issue-term="{{ $issue }}"
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
||||
7
blog/themes/anubis/layouts/robots.txt
Normal file
7
blog/themes/anubis/layouts/robots.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
User-agent: *
|
||||
# robotstxt.org - if ENV production variable is false robots will be disallowed.
|
||||
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
|
||||
Disallow:
|
||||
{{ else }}
|
||||
Disallow: /
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user