diff options
Diffstat (limited to 'layouts')
29 files changed, 379 insertions, 309 deletions
diff --git a/layouts/404.html b/layouts/404.html index eec3ded..ee8fb79 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,5 +1,5 @@ {{ define "main" }} -<div class="main-title" style="padding-top: 1.5rem;"> +<div class="404-not-found" style="font-size: 2rem; padding-top: 1.5rem;"> <span>404 NOT FOUND</span> </div> {{ end }}
\ No newline at end of file diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index f9493b1..b9020c7 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1 +1 @@ -<img class="img-zoomable" src="{{ .Destination | safeURL }}" alt="{{ .Text }}"{{ with .Title }} title="{{ . }}"{{ end }} />
\ No newline at end of file +<img class="img-zoomable" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />
\ No newline at end of file diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index cb4b911..42216b4 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -6,11 +6,11 @@ <!-- archives range in all posts --> {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) 50 }} {{ range $paginator.Pages }} -<div class="post-archive"> - <h2 class="post-title-archive"> +<div class="post"> + <h3 class="post-item post-title-archive"> <a href="{{ .Permalink }}">{{ .Title }}</a> - </h2> - <div class="post-meta-archive link-alter"> + </h3> + <div class="post-item post-meta-archive"> {{ partial "post-meta.html" . }} </div> </div> @@ -22,16 +22,16 @@ {{ $lowerLimit := (add $offsetLinks 1) }} {{ $upperLimit := (sub $paginator.TotalPages $offsetLinks) }} {{ if gt $paginator.TotalPages 1 }} -<ul class="pagination"> +<div class="pagination"> {{ if ne $paginator.PageNumber 1 }} - <li class="pag-first"> - <a href="{{ $paginator.First.URL }}"><i class="fas fa-angle-double-left"></i></a> - </li> + <div class="pag-first"> + <a href="{{ $paginator.First.URL }}"><ion-icon name="caret-back-circle"></ion-icon></a> + </div> {{ end }} {{ if $paginator.HasPrev }} - <li class="pag-previous"> - <a href="{{ $paginator.Prev.URL }}"><i class="fas fa-angle-left"></i></a> - </li> + <div class="pag-previous"> + <a href="{{ $paginator.Prev.URL }}"><ion-icon name="chevron-back-circle"></ion-icon></a> + </div> {{ end }} {{ range $paginator.Pagers }} {{ $.Scratch.Set "pageNumFlag" false }} @@ -53,22 +53,22 @@ {{ $.Scratch.Set "pageNumFlag" true }} {{ end }} {{ if eq ($.Scratch.Get "pageNumFlag") true }} - <li class="pag-item{{ if eq . $paginator }} pag-current{{ end }}"> + <div class="pag-item{{ if eq . $paginator }} pag-current{{ end }}"> <a href="{{ .URL }}">{{ .PageNumber }}</a> - </li> + </div> {{ end }} {{ end }} {{ if $paginator.HasNext }} - <li class="pag-next"> - <a href="{{ $paginator.Next.URL }}"><i class="fas fa-angle-right"></i></a> - </li> + <div class="pag-next"> + <a href="{{ $paginator.Next.URL }}"><ion-icon name="chevron-forward-circle"></ion-icon></i></a> + </div> {{ end }} {{ if ne $paginator.PageNumber $paginator.TotalPages }} - <li class="pag-last"> - <a href="{{ $paginator.Last.URL }}"><i class="fas fa-angle-double-right"></i></a> - </li> + <div class="pag-last"> + <a href="{{ $paginator.Last.URL }}"><ion-icon name="caret-forward-circle"></ion-icon></a> + </div> {{ end }} -</ul> +</div> {{ end }} {{ end }}
\ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 8d4a8db..4a2a490 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,34 +1,30 @@ <!DOCTYPE html> <html lang="{{ .Site.Language.Lang }}"> -{{ partial "head.html" . }} -<body class="d-flex flex-column h-100"> +<head> + {{ partial "head.html" . }} +</head> + +<body data-theme="auto"> + {{ partial "scripts-front.html" . }} {{ partial "header.html" . }} <main> <div class="container-lg clearfix"> <!-- list --> - <div class="col-md-9 col-12 float-left" id="content"> + <div class="col-12 col-md-9 float-left content"> {{ block "main" . }}{{ end }} </div> - <!-- sidebar --> - <div class="col-md-3 col-12 float-left link-alter" id="sidebar"> - {{ partial "sidebar.html" . }} - </div> - <!-- global APlayer --> - {{ if .Site.Params.playerURL }} - <div id="aplayer"></div> - {{ end }} - {{ if .Site.Params.scrollTop }} - <div id="scroll-top"> - <i class="fas fa-chevron-up"></i> - </div> - {{ end }} + {{ partial "sidebar.html" . }} </div> + {{ partial "components.html" . }} </main> {{ partial "footer.html" . }} - {{ partial "scripts.html" . }} + {{ if or .Params.math .Site.Params.math }} + {{ partial "math.html" . }} + {{ end }} + {{ partial "scripts-end.html" . }} </body> </html>
\ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index bcefcc2..5118a49 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -3,13 +3,13 @@ {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }} {{ range $paginator.Pages }} <div class="post"> - <h2 class="post-title"> + <h2 class="post-item post-title"> <a href="{{ .Permalink }}">{{ .Title }}</a> </h2> - <div class="post-meta link-alter"> + <div class="post-item post-meta"> {{ partial "post-meta.html" . }} </div> - <div class="post-summary markdown-body"> + <div class="post-item post-summary markdown-body"> {{ .Summary }} </div> </div> @@ -21,16 +21,16 @@ {{ $lowerLimit := (add $offsetLinks 1) }} {{ $upperLimit := (sub $paginator.TotalPages $offsetLinks) }} {{ if gt $paginator.TotalPages 1 }} -<ul class="pagination"> +<div class="pagination"> {{ if ne $paginator.PageNumber 1 }} - <li class="pag-first"> - <a href="{{ $paginator.First.URL }}"><i class="fas fa-angle-double-left"></i></a> - </li> + <div class="pag-first"> + <a href="{{ $paginator.First.URL }}"><ion-icon name="caret-back-circle"></ion-icon></a> + </div> {{ end }} {{ if $paginator.HasPrev }} - <li class="pag-previous"> - <a href="{{ $paginator.Prev.URL }}"><i class="fas fa-angle-left"></i></a> - </li> + <div class="pag-previous"> + <a href="{{ $paginator.Prev.URL }}"><ion-icon name="chevron-back-circle"></ion-icon></a> + </div> {{ end }} {{ range $paginator.Pagers }} {{ $.Scratch.Set "pageNumFlag" false }} @@ -52,22 +52,22 @@ {{ $.Scratch.Set "pageNumFlag" true }} {{ end }} {{ if eq ($.Scratch.Get "pageNumFlag") true }} - <li class="pag-item{{ if eq . $paginator }} pag-current{{ end }}"> + <div class="pag-item{{ if eq . $paginator }} pag-current{{ end }}"> <a href="{{ .URL }}">{{ .PageNumber }}</a> - </li> + </div> {{ end }} {{ end }} {{ if $paginator.HasNext }} - <li class="pag-next"> - <a href="{{ $paginator.Next.URL }}"><i class="fas fa-angle-right"></i></a> - </li> + <div class="pag-next"> + <a href="{{ $paginator.Next.URL }}"><ion-icon name="chevron-forward-circle"></ion-icon></i></a> + </div> {{ end }} {{ if ne $paginator.PageNumber $paginator.TotalPages }} - <li class="pag-last"> - <a href="{{ $paginator.Last.URL }}"><i class="fas fa-angle-double-right"></i></a> - </li> + <div class="pag-last"> + <a href="{{ $paginator.Last.URL }}"><ion-icon name="caret-forward-circle"></ion-icon></a> + </div> {{ end }} -</ul> +</div> {{ end }} {{ end }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e2b0fc1..db5e2f5 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,10 +1,10 @@ {{ define "main" }} <article> <!-- post meta --> - <h4 class="post-title"> + <h2 class="post-item post-title"> <a href="{{ .Permalink }}">{{ .Title }}</a> - </h4> - <div class="post-meta link-alter"> + </h2> + <div class="post-item post-meta"> {{ partial "post-meta.html" . }} </div> {{ with .Params.playerURL }} @@ -16,15 +16,19 @@ </div> </article> <!-- post license --> -{{ if ne .Params.noLicense true }} +{{ if and (.Site.Params.showLicense) (ne .Params.noLicense true) }} <div class="license markdown-body"> <blockquote> - <p>{{ i18n "postCopyrightFront" }}<a rel="license" href="{{ .Site.Params.licenseLink }}" target="_blank">{{ .Site.Params.license }}</a>{{ i18n "postCopyrightEnd" }}</p> + <p>{{ i18n "postCopyrightFront" }}<a rel="license" href="{{ .Site.Params.licenseLink }}" + target="_blank">{{ .Site.Params.license }}</a>{{ i18n "postCopyrightEnd" }}</p> </blockquote> </div> {{ end }} -{{ if ne .Params.noComments true }} -{{ partial "comment-utterances.html" . }} +{{ if .Site.Params.disqusJSApi }} +{{ partial "comment-disqusjs.html" . }} +{{ else if .Site.Params.disqusShortname }} {{ partial "comment-disqus.html" . }} -{{ end }} +{{ else if .Site.Params.utterancesRepo }} +{{ partial "comment-utterances.html" . }} +{{ else }}{{ end }} {{ end }}
\ No newline at end of file diff --git a/layouts/_default/tag.html b/layouts/_default/tag.html index 97d6ead..fa5af3d 100644 --- a/layouts/_default/tag.html +++ b/layouts/_default/tag.html @@ -7,13 +7,13 @@ {{ $paginator := .Paginator }} {{ range $paginator.Pages }} <div class="post"> - <h2 class="post-title"> + <h2 class="post-item post-title"> <a href="{{ .Permalink }}">{{ .Title }}</a> </h2> - <div class="post-meta link-alter"> + <div class="post-item post-meta"> {{ partial "post-meta.html" . }} </div> - <div class="post-summary markdown-body"> + <div class="post-item post-summary markdown-body"> {{ .Summary }} </div> </div> @@ -25,16 +25,16 @@ {{ $lowerLimit := (add $offsetLinks 1) }} {{ $upperLimit := (sub $paginator.TotalPages $offsetLinks) }} {{ if gt $paginator.TotalPages 1 }} -<ul class="pagination"> +<div class="pagination"> {{ if ne $paginator.PageNumber 1 }} - <li class="pag-first"> - <a href="{{ $paginator.First.URL }}"><i class="fas fa-angle-double-left"></i></a> - </li> + <div class="pag-first"> + <a href="{{ $paginator.First.URL }}"><ion-icon name="caret-back-circle"></ion-icon></a> + </div> {{ end }} {{ if $paginator.HasPrev }} - <li class="pag-previous"> - <a href="{{ $paginator.Prev.URL }}"><i class="fas fa-angle-left"></i></a> - </li> + <div class="pag-previous"> + <a href="{{ $paginator.Prev.URL }}"><ion-icon name="chevron-back-circle"></ion-icon></a> + </div> {{ end }} {{ range $paginator.Pagers }} {{ $.Scratch.Set "pageNumFlag" false }} @@ -56,22 +56,22 @@ {{ $.Scratch.Set "pageNumFlag" true }} {{ end }} {{ if eq ($.Scratch.Get "pageNumFlag") true }} - <li class="pag-item{{ if eq . $paginator }} pag-current{{ end }}"> + <div class="pag-item{{ if eq . $paginator }} pag-current{{ end }}"> <a href="{{ .URL }}">{{ .PageNumber }}</a> - </li> + </div> {{ end }} {{ end }} {{ if $paginator.HasNext }} - <li class="pag-next"> - <a href="{{ $paginator.Next.URL }}"><i class="fas fa-angle-right"></i></a> - </li> + <div class="pag-next"> + <a href="{{ $paginator.Next.URL }}"><ion-icon name="chevron-forward-circle"></ion-icon></i></a> + </div> {{ end }} {{ if ne $paginator.PageNumber $paginator.TotalPages }} - <li class="pag-last"> - <a href="{{ $paginator.Last.URL }}"><i class="fas fa-angle-double-right"></i></a> - </li> + <div class="pag-last"> + <a href="{{ $paginator.Last.URL }}"><ion-icon name="caret-forward-circle"></ion-icon></a> + </div> {{ end }} -</ul> +</div> {{ end }} {{ end }}
\ No newline at end of file diff --git a/layouts/partials/analytic-cfga.html b/layouts/partials/analytic-cfga.html new file mode 100644 index 0000000..63db4d6 --- /dev/null +++ b/layouts/partials/analytic-cfga.html @@ -0,0 +1,7 @@ +{{ if .Site.Params.googleAnalyticsTid }} +<script> + window.ga_tid = '{{ .Site.Params.googleAnalyticsTid }}'; + window.ga_api = '{{ .Site.Params.googleAnalyticsRoute }}'; +</script> +<script async src="https://cdn.jsdelivr.net/npm/cfga@1.0.1/cfga.min.js"></script> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/analytic-gtag.html b/layouts/partials/analytic-gtag.html new file mode 100644 index 0000000..f851745 --- /dev/null +++ b/layouts/partials/analytic-gtag.html @@ -0,0 +1,13 @@ +{{ with .Site.GoogleAnalytics }} +<!-- GA --> +<script> + window.dataLayer = window.dataLayer || []; + + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', '{{ . }}'); +</script> +<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/comment-disqus.html b/layouts/partials/comment-disqus.html index 539f8c7..782e369 100644 --- a/layouts/partials/comment-disqus.html +++ b/layouts/partials/comment-disqus.html @@ -1,18 +1,21 @@ -{{ with .Site.Params.disqusShortname }} -<div class="post-comment"> - <div id="disqus_thread"></div> +<div class="post-comment" data-comment="disqus"> + <span class="post-comment-notloaded"> + <ion-icon name="chatbox-ellipses"></ion-icon> {{ i18n "postComment" }} + </span> + <div id="disqus_thread" style="display: none;"></div> <script> - var disqus_config = function () { - this.page.url = "{{ $.Permalink }}"; - this.page.identifier = "{{ $.RelPermalink }}"; - }; - (function () { - var d = document, - s = d.createElement('script'); - s.src = 'https://{{ . }}.disqus.com/embed.js'; + function loadComment() { + var commentArea = document.querySelector('.post-comment'); + var disqus_config = function () { + this.page.url = '{{ .Permalink }}'; + this.page.identifier = '{{ .File.ContentBaseName }}'; + }; + var s = document.createElement('script'); + s.src = 'https://' + '{{ .Site.Params.disqusShortname }}' + '.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); - (d.head || d.body).appendChild(s); - })(); + document.querySelector('#disqus_thread').removeAttribute('style'); + (document.body || document.head).appendChild(s); + document.querySelector('span.post-comment-notloaded').setAttribute('style', 'display: none;'); + } </script> -</div> -{{ end }}
\ No newline at end of file +</div>
\ No newline at end of file diff --git a/layouts/partials/comment-disqusjs.html b/layouts/partials/comment-disqusjs.html new file mode 100644 index 0000000..eafa1de --- /dev/null +++ b/layouts/partials/comment-disqusjs.html @@ -0,0 +1,22 @@ +<div class="post-comment" data-comment="disqus"> + <span class="post-comment-notloaded"> + <ion-icon name="chatbox-ellipses"></ion-icon> {{ i18n "postComment" }} + </span> + <div id="disqus_thread" style="display: none;"></div> + <script src="https://cdn.jsdelivr.net/npm/disqusjs@1.3/dist/disqus.js"></script> + <script> + function loadComment() { + document.querySelector('#disqus_thread').removeAttribute('style'); + var dsqjs = new DisqusJS({ + shortname: '{{ .Site.Params.disqusShortname }}', + siteName: '{{ .Site.Title }}', + identifier: '{{ .File.ContentBaseName }}', + url: '{{ .Permalink }}', + title: '{{ .Title }}', + api: '{{ .Site.Params.disqusJSApi }}', + apikey: '{{ .Site.Params.disqusJSApikey }}' + }); + document.querySelector('span.post-comment-notloaded').setAttribute('style', 'display: none;'); + } + </script> +</div>
\ No newline at end of file diff --git a/layouts/partials/comment-utterances.html b/layouts/partials/comment-utterances.html index 3e56201..f8683b6 100644 --- a/layouts/partials/comment-utterances.html +++ b/layouts/partials/comment-utterances.html @@ -1,9 +1,26 @@ -{{ with .Site.Params.utterancesRepo }} -<div class="post-loading"> - <i class="fas fa-circle-notch fa-spin"></i> - <p>{{ i18n "postCommentLoading" }}</p> -</div> -<div class="post-comment"> - <script src="https://utteranc.es/client.js" repo="{{ . }}" issue-term="{{ $.Site.Params.utterancesIssueTerm }}" theme="{{ $.Site.Params.utterancesTheme }}" crossorigin="anonymous" async></script> -</div> -{{ end }}
\ No newline at end of file +<div class="post-comment" data-comment="utterances"> + <span class="post-comment-notloaded"> + <ion-icon name="chatbox-ellipses"></ion-icon> {{ i18n "postComment" }} + </span> + <script> + function loadComment() { + var commentArea = document.querySelector('.post-comment'); + var utterancesTheme = document.body.getAttribute('data-theme'); + if (utterancesTheme === 'auto') { + utterancesTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'photon-dark' : + 'github-light'; + } else { + utterancesTheme = utterancesTheme === 'dark' ? 'photon-dark' : 'github-light'; + } + var s = document.createElement('script'); + s.src = 'https://utteranc.es/client.js'; + s.setAttribute('repo', '{{ .Site.Params.utterancesRepo }}'); + s.setAttribute('issue-term', '{{ .Site.Params.utterancesIssueTerm }}'); + s.setAttribute('theme', utterancesTheme); + s.setAttribute('crossorigin', 'anonymous'); + s.setAttribute('async', ''); + document.querySelector('.post-comment').appendChild(s); + document.querySelector('span.post-comment-notloaded').setAttribute('style', 'display: none;'); + } + </script> +</div>
\ No newline at end of file diff --git a/layouts/partials/components.html b/layouts/partials/components.html new file mode 100644 index 0000000..58f9c29 --- /dev/null +++ b/layouts/partials/components.html @@ -0,0 +1,8 @@ +<div class="btn"> + <div class="btn-toggle-mode"> + <ion-icon name="contrast"></ion-icon> + </div> + <div class="btn-scroll-top"> + <ion-icon name="chevron-up"></ion-icon> + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index be8f5bf..cb43e10 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,5 +1,10 @@ <footer> - <div class="container-lg text-center"> - <p>© {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Params.author }}</a> | {{ i18n "footerPoweredFront" }}<a href="https://github.com/amzrk2/hugo-theme-fuji/" target="_blank">Fuji</a> & <a href="https://gohugo.io/" target="_blank">Hugo</a>{{ i18n "footerPoweredEnd" }}</p> + <div class="container-lg clearfix"> + <div class="col-12 footer"> + <span>© {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Params.author }}</a> | + {{ i18n "footerPoweredFront" }}<a href="https://github.com/amzrk2/hugo-theme-fuji/" + target="_blank">Fuji-v2</a> & <a href="https://gohugo.io/" + target="_blank">Hugo</a>{{ i18n "footerPoweredEnd" }}</span> + </div> </div> </footer>
\ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 134f6e4..2d7362c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -18,51 +18,38 @@ {{ else }} <title>{{ .Title }} - {{ .Site.Title }}</title> {{ end }} -<meta name="author" content="{{if .Params.author }}{{ .Params.author }}{{ else }}{{ .Site.Params.author }}{{ end }}" /> -<meta name="description" content="{{if .Params.description }}{{ .Params.description }}{{ else if .Summary }}{{ .Summary }}{{ else }}{{ .Site.Params.description }}{{ end }}" /> +{{ if or (.Params.author) (.Site.Params.author) }} +<meta name="author" content="{{ if .Params.author }}{{ .Params.author }}{{ else }}{{ .Site.Params.author }}{{ end }}" /> +{{ end }} +{{ if or (.Params.description) (.Site.Params.description) }} +<meta name="description" + content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.description }}{{ end }}" /> +{{ end }} {{ if .Params.tags }} <meta name="keywords" content="{{ delimit .Params.tags ", " }}" /> {{ end }} + {{ template "_internal/opengraph.html" . }} {{ template "_internal/twitter_cards.html" . }} -{{ template "_internal/google_analytics_async.html" . }} -<!-- global main css --> -{{ $options := (dict "targetPath" "css/main.min.css" "outputStyle" "compressed") }} -{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }} +<!-- dep --> +{{ if .Site.Params.mainAssetsCDN }} +<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/amzrk2/hugo-theme-fuji@2.0/dist/fuji.min.css" /> +{{ else }} +{{ if .Site.Params.useHugoPipes }} +{{ $options := (dict "targetPath" "assets/css/fuji-custom.min.css" "outputStyle" "compressed") }} +{{ $style := resources.Get "scss/fuji.scss" | resources.ToCSS $options }} <link rel="stylesheet" href="{{ $style.Permalink }}" /> - -<!-- global dependency (CDN) --> -{{ if .Site.Params.useCDN }} -<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.min.js" integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script> -<script src="https://cdn.jsdelivr.net/npm/lazysizes@5.2.0/lazysizes.min.js" integrity="sha256-h2tMEmhemR2IN4wbbdNjj9LaDIjzwk2hralQwfJmBOE=" crossorigin="anonymous"></script> -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.0/css/all.min.css" integrity="sha256-h20CPZ0QyXlBuAw7A+KluUYx/3pK+c7lYEpqLTlxjYQ=" crossorigin="anonymous" /> -<script src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.5/dist/medium-zoom.min.js" integrity="sha256-Jd9xef1tT52aCb+cAqhElj/9D3c99lQvEjyKOuPn3S4=" crossorigin="anonymous"></script> -{{ if or (.Site.Params.playerURL) (.Params.playerURL) }} -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css" integrity="sha256-uqQQGnDcmRKvhKwc5Vm4XT1GQ2oV6t1U0NR2N9tV+BQ=" crossorigin="anonymous" /> -<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js" integrity="sha256-6Y7CJDaltoeNgk+ZftgCD9jLgmGv4xKUo8nQ0HgAwVo=" crossorigin="anonymous"></script> -{{ end }} -<!-- global dependency (LOCAL) --> {{ else }} -{{ $jquery := resources.Get "js/jquery.min.js" }} -<script src="{{ $jquery.Permalink }}"></script> -{{ $lazysizes := resources.Get "js/lazysizes.min.js" }} -<script src="{{ $lazysizes.Permalink }}"></script> -{{ $fontawesome := resources.Get "css/fontawsome.min.css" }} -<link rel="stylesheet" href="{{ $fontawesome.Permalink }}" /> -{{ $zoom := resources.Get "js/medium-zoom.min.js" }} -<script src="{{ $zoom.Permalink }}"></script> -{{ if or (.Site.Params.playerURL) (.Params.playerURL) }} -{{ $aplayerCSS := resources.Get "css/APlayer.min.css" }} -<link rel="stylesheet" href="{{ $aplayerCSS.Permalink }}" /> -{{ $aplayerJS := resources.Get "js/APlayer.min.js" }} -<script src="{{ $aplayerJS.Permalink }}"></script> +<link rel="stylesheet" href="{{ "/assets/css/fuji.min.css" | relURL }}" /> +{{ end }} +{{ end }} +{{ if .Params.playerURL }} +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css" /> {{ end }} +{{ if .Site.Params.useDisqusJS }} +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/disqusjs@1.3/dist/disqusjs.css" /> {{ end }} -<!-- optional katex math --> -{{ if or (.Params.math) (.Site.Params.math) }} -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous" /> -<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script> -<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script> -{{ end }}
\ No newline at end of file +{{ partial "analytic-gtag.html" . }} +{{ partial "analytic-cfga.html" . }}
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 3166a36..a08e2d9 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,9 +1,9 @@ <header> <div class="container-lg clearfix"> - <div class="col-12 link-primary"> - <a class="main-title" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> + <div class="col-12 header"> + <a class="title-main" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> {{ with .Site.Params.subTitle }} - <span class="sub-title">{{ . }}</span> + <span class="title-sub">{{ . }}</span> {{ end }} </div> </div> diff --git a/layouts/partials/math.html b/layouts/partials/math.html new file mode 100644 index 0000000..aca973a --- /dev/null +++ b/layouts/partials/math.html @@ -0,0 +1,4 @@ +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" /> +<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"></script> +<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" + onload="renderMathInElement(document.body);"></script>
\ No newline at end of file diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html index 80f3a16..5176053 100644 --- a/layouts/partials/post-meta.html +++ b/layouts/partials/post-meta.html @@ -1 +1 @@ -<time><i class="fas fa-calendar-day"></i> {{ .Date.Format "2006-01-02" }}</time>{{ if .Site.Params.showWordCounter }}<span><i class="fas fa-file-alt"></i> {{ .WordCount }}{{ i18n "postMetaWordCount" }}</span>{{ end }}{{ if .Site.Params.showReadTime }}<span><i class="fas fa-clock"></i> {{ .ReadingTime }}{{ i18n "postMetaReadingTime" }}</span>{{ end }}<span><i class="fas fa-tag"></i> {{ if .Params.tags }}{{ range .Params.tags }}<a href="/tags/{{ . | urlize }}/">{{ . }}</a> {{ end }}{{ else }}{{ i18n "postMetaNoTag" }}{{ end }}</span>
\ No newline at end of file +<span><ion-icon name="today"></ion-icon></ion-icon> {{ .Date.Format "2006-01-02" }}</span>{{ if .Site.Params.showWordCounter }}<span><ion-icon name="file-tray"></ion-icon> {{ .WordCount }}{{ i18n "postMetaWordCount" }}</span>{{ end }}{{ if .Site.Params.showReadTime }}<span><ion-icon name="stopwatch"></ion-icon> {{ .ReadingTime }}{{ i18n "postMetaReadingTime" }}</span>{{ end }}<span><ion-icon name="pricetags"></ion-icon> {{ if .Params.tags }}{{ range .Params.tags }}<a href="{{ "/tags/" | relURL }}{{ . | urlize}}">{{ . }}</a> {{ end }}{{ else }}{{ i18n "postMetaNoTag" }}{{ end }}</span>
\ No newline at end of file diff --git a/layouts/partials/scripts-end.html b/layouts/partials/scripts-end.html new file mode 100644 index 0000000..3cbc866 --- /dev/null +++ b/layouts/partials/scripts-end.html @@ -0,0 +1,38 @@ +<script src="https://cdn.jsdelivr.net/npm/lazysizes@5.2.2/lazysizes.min.js"></script> +<script src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.5/dist/medium-zoom.min.js"></script> +<script type="module" src="https://cdn.jsdelivr.net/npm/ionicons@5.0.1/dist/ionicons/ionicons.esm.js"></script> +<script nomodule="" src="https://cdn.jsdelivr.net/npm/ionicons@5.0.1/dist/ionicons/ionicons.js"></script> +{{ if .Site.Params.mainAssetsCDN }} +<script src="https://cdn.jsdelivr.net/gh/amzrk2/hugo-theme-fuji@2.0/dist/fuji.min.js"></script> +{{ else }} +<script src="{{ "/assets/js/fuji.min.js" | relURL }}"></script> +{{ end }} +<script src="https://cdn.jsdelivr.net/npm/prismjs@1.20.0/components/prism-core.min.js"></script> +<script src="https://cdn.jsdelivr.net/npm/prismjs@1.20.0/plugins/autoloader/prism-autoloader.min.js"></script> + +{{ with .Params.playerURL }} +<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script> +<script> + // in-post aplayer + var aPlayer = new APlayer({ + container: document.getElementById('post-aplayer'), + theme: '#8f82bc', + volume: 0.1, + audio: [{ + name: '{{ $.Params.playerName }}', + artist: '{{ $.Params.playerArtist }}', + url: '{{ . }}', + cover: '{{ $.Params.playerCover }}' + }] + }); + // aplayer toc anchors fix + // see https://github.com/MoePlayer/APlayer/issues/242#issuecomment-602471423 + document.addEventListener('DOMContentLoaded', function () { + var issueTocEle = document.querySelector('.sidebar-toc'); + if (issueTocEle) { + var newTocEle = issueTocEle.cloneNode(true); + issueTocEle.parentNode.replaceChild(newTocEle, issueTocEle); + } + }); +</script> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/scripts-front.html b/layouts/partials/scripts-front.html new file mode 100644 index 0000000..c516aad --- /dev/null +++ b/layouts/partials/scripts-front.html @@ -0,0 +1,28 @@ +<script data-cfasync="false"> + // detect theme data in localStorage + var fujiThemeData = localStorage.getItem('fuji_data-theme'); + // if first look, set theme mode to auto + if (!fujiThemeData) { + localStorage.setItem('fuji_data-theme', 'auto'); + } else { + // if not auto mode, change the data-theme attribute of body + if (fujiThemeData !== 'auto') { + document.body.setAttribute('data-theme', fujiThemeData === 'dark' ? 'dark' : 'light'); + } + } +</script> +<script data-cfasync="false"> + // ie detection + var ua = window.navigator.userAgent; + + function browserDetection() { + if (ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0 || ua.indexOf('Edge/') > 0) { + return true; + } + return false; + } + + if (browserDetection()) { + window.location.href('{{ "/ie/" | absURL }}'); + } +</script>
\ No newline at end of file diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html deleted file mode 100644 index 6bcdd8b..0000000 --- a/layouts/partials/scripts.html +++ /dev/null @@ -1,97 +0,0 @@ -<!-- init zoomable images --> -<script> - $(function () { - mediumZoom('.img-zoomable', { - margin: 32 - }); - }); -</script> - -<!-- utterances comment loading indicator --> -{{ if ne .Params.noComments true }} -{{ if and (.IsPage) (.Site.Params.utterancesRepo) }} -<script> - $(function () { - var commentStatus; - var commentLoadingTime = 0; - var commentCheckInterval = self.setInterval(checkUtterances, 500); - - function checkUtterances() { - commentStatus = $('.post-comment .utterances').attr('style'); - if (commentStatus == undefined) { - commentLoadingTime += 1; - if (commentLoadingTime > 20) { - clearInterval(commentCheckInterval); - $('.post-comment').hide(); - $('.post-loading p').text('{{ i18n "postCommentLoadingFailed" }}'); - $('.post-loading i').attr('class', 'far fa-times-circle'); - } - return; - } else { - clearInterval(commentCheckInterval); - $('.post-loading').hide(); - } - } - }); -</script> -{{ end }} -{{ end }} - -<!-- toc smooth scroll & APlayer cjk html anchor fix --> -{{ if in .Site.Params.mainSections .Type }} -<script> - $('.widget-toc a').click(function () { - $('html, body').animate({ - scrollTop: $($(this).attr('href')).offset().top - }); - }); -</script> -{{ end }} -{{ if .Site.Params.scrollTop }} -<!-- scroll to top button --> -<script> - $('#scroll-top').click(function () { - $('html, body').animate({ - scrollTop: 0 - }); - }); -</script> -{{ end }} - -<!-- in-post APlayer --> -{{ with .Params.playerURL }} -<script> - $(function () { - const postAPlayer = new APlayer({ - container: document.getElementById('post-aplayer'), - theme: '#8F82BC', - volume: 0.1, - audio: [{ - name: '{{ $.Params.playerName }}', - artist: '{{ $.Params.playerArtist }}', - url: '{{ . }}', - cover: '{{ $.Params.playerCover }}' - }] - }); - }); -</script> -{{ end }} -<!-- site global APlayer --> -{{ with .Site.Params.playerURL }} -<script> - $(function () { - const siteAPlayer = new APlayer({ - container: document.getElementById('aplayer'), - fixed: true, - theme: '#8F82BC', - volume: 0.1, - audio: [{ - name: '{{ $.Site.Params.playerName }}', - artist: '{{ $.Site.Params.playerArtist }}', - url: '{{ . }}', - cover: '{{ $.Site.Params.playerCover }}' - }] - }); - }); -</script> -{{ end }}
\ No newline at end of file diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 51e53d3..7ead0e2 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,51 +1,53 @@ -<!-- in-post toc --> -{{ if in .Site.Params.mainSections .Type }} -<div class="widget-toc"> - <h5>{{ i18n "sidebarToc" }}</h5> - {{.TableOfContents}} -</div> -{{ end }} -<!-- pages --> -<div class="widget-pages"> - <h5>{{ i18n "sidebarPages" }}</h5> - <ul> - {{ $currentPage := . }} - {{ range .Site.Menus.nav }} - <li> - <a href="{{ .URL }}">{{ .Name }}</a> - </li> - {{ end }} - <li> - <a href="/index.xml" target="_blank">RSS</a> - </li> - </ul> -</div> -<!-- tags --> -<div class="widget-tags"> - <h5>{{ i18n "sidebarTags" }}</h5> - <div> - {{ range .Site.Taxonomies.tags }} - <span> - <a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> - </span> - {{ end }} +<aside class="col-12 col-md-3 float-left sidebar"> + <!-- in-post toc --> + {{ if and (in .Site.Params.mainSections .Type) (and (.Site.Params.showToc) (ne .Params.noToc true)) }} + <div class="sidebar-item sidebar-toc"> + <h3>{{ i18n "sidebarToc" }}</h3> + {{ .TableOfContents }} </div> -</div> -<!-- links --> -<div class="widget-links"> - <h5>{{ i18n "sidebarLinks" }}</h5> - <ul> - {{ range .Site.Menus.link }} - <li> - <a href="{{ .URL }}" target="_blank"><span>{{ .Name }}</span></a> - </li> - {{ end }} - </ul> -</div> -<!-- bgm.tv image chart --> -{{ with .Site.Params.bgmImageChart }} -<div class="widget-bgm"> - <h5>{{ i18n "sidebarBangumiChart" }}</h5> - <img class="lazyload" src="{{ $.Site.Params.lazyPlaceholder }}" data-src="https://bgm.tv/chart/img/{{ . }}" alt="Bangumi Image Chart" /> -</div> -{{ end }}
\ No newline at end of file + {{ end }} + <!-- pages --> + <div class="sidebar-item sidebar-pages"> + <h3>{{ i18n "sidebarPages" }}</h3> + <ul> + {{ range .Site.Menus.nav }} + <li> + <a href="{{ .URL }}">{{ .Name }}</a> + </li> + {{ end }} + <li> + <a href="{{ "/index.xml" | relURL }}" target="_blank">RSS</a> + </li> + </ul> + </div> + <!-- tags --> + <div class="sidebar-item sidebar-tags"> + <h3>{{ i18n "sidebarTags" }}</h3> + <div> + {{ range .Site.Taxonomies.tags }} + <span> + <a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> + </span> + {{ end }} + </div> + </div> + <!-- links --> + <div class="sidebar-item sidebar-links"> + <h3>{{ i18n "sidebarLinks" }}</h3> + <ul> + {{ range .Site.Menus.link }} + <li> + <a href="{{ .URL }}" target="_blank"><span>{{ .Name }}</span></a> + </li> + {{ end }} + </ul> + </div> + {{ with .Site.Params.bgmImageChart }} + <!-- bgm.tv image chart --> + <div class="sidebar-item sidebar-bgm"> + <h3>{{ i18n "sidebarBangumiChart" }}</h3> + <img class="lazyload" src="{{ $.Site.Params.lazyPlaceholder | relURL }}" data-src="https://bgm.tv/chart/img/{{ . }}" + alt="Bangumi εΎεζ¦ε" /> + </div> + {{ end }} +</aside>
\ No newline at end of file diff --git a/layouts/robots.txt b/layouts/robots.txt index 4c807e2..34dd235 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -1,3 +1,3 @@ User-agent: * -Sitemap: {{ .Site.BaseURL }}/sitemap.xml +Sitemap: {{ "/sitemap.xml" | absURL }} diff --git a/layouts/shortcodes/img-lazy.html b/layouts/shortcodes/img-lazy.html new file mode 100644 index 0000000..fef9bd3 --- /dev/null +++ b/layouts/shortcodes/img-lazy.html @@ -0,0 +1,10 @@ +{{ if len .Params | eq 2 }} +<img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholder | relURL }}" data-src="{{ index .Params 1 }}" + alt="{{ index .Params 0 }}" /> +{{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} +<img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholderRow | relURL }}" data-src="{{ index .Params 2 }}" + alt="{{ index .Params 1 }}" /> +{{ else if eq (index .Params 0) "col" }} +<img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholderCol | relURL }}" data-src="{{ index .Params 2 }}" + alt="{{ index .Params 1 }}" /> +{{ else }}{{ end }}{{ else }}{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/img-nz-lazy.html b/layouts/shortcodes/img-nz-lazy.html new file mode 100644 index 0000000..bfdb26a --- /dev/null +++ b/layouts/shortcodes/img-nz-lazy.html @@ -0,0 +1,25 @@ +{{ if len .Params | eq 2 }} +<img class="lazyload" src="{{ .Site.Params.lazyPlaceholder | relURL }}" data-src="{{ index .Params 1 }}" + alt="{{ index .Params 0 }}" /> +{{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} +<img class="lazyload" src="{{ .Site.Params.lazyPlaceholderRow | relURL }}" data-src="{{ index .Params 2 }}" + alt="{{ index .Params 1 }}" /> +{{ else if eq (index .Params 0) "col" }} +<img class="lazyload" src="{{ .Site.Params.lazyPlaceholderCol | relURL }}" data-src="{{ index .Params 2 }}" + alt="{{ index .Params 1 }}" /> +{{ else }} +<a href="{{ index .Params 2 }}" target="_blank"> + <img class="lazyload" src="{{ .Site.Params.lazyPlaceholder | relURL }}" data-src="{{ index .Params 1 }}" + alt="{{ index .Params 0 }}" /> +</a> +{{ end }}{{ else if len .Params | eq 4 }}{{ if eq (index .Params 0) "row" }} +<a href="{{ index .Params 3 }}" target="_blank"> + <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderRow | relURL }}" data-src="{{ index .Params 2 }}" + alt="{{ index .Params 1 }}" /> +</a> +{{ else if eq (index .Params 0) "col" }} +<a href="{{ index .Params 3 }}" target="_blank"> + <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderCol | relURL }}" data-src="{{ index .Params 2 }}" + alt="{{ index .Params 1 }}" /> +</a> +{{ else }}{{ end }}{{ else }}{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/img-nz.html b/layouts/shortcodes/img-nz.html new file mode 100644 index 0000000..1b4f791 --- /dev/null +++ b/layouts/shortcodes/img-nz.html @@ -0,0 +1,7 @@ +{{ if (index .Params 2) }} +<a href="{{ index .Params 2 }}" target="_blank"> + <img src="{{ index .Params 1 }}" alt="{{ index .Params 0 }}" /> +</a> +{{ else }} +<img src="{{ index .Params 1 }}" alt="{{ index .Params 0 }}" /> +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/lazyimg-col.html b/layouts/shortcodes/lazyimg-col.html deleted file mode 100644 index ce68446..0000000 --- a/layouts/shortcodes/lazyimg-col.html +++ /dev/null @@ -1,3 +0,0 @@ -<p> - <img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholderCol }}" data-src="{{ index .Params 1 }}" alt="{{ index .Params 0 }}" /> -</p>
\ No newline at end of file diff --git a/layouts/shortcodes/lazyimg-row.html b/layouts/shortcodes/lazyimg-row.html deleted file mode 100644 index 61e61ec..0000000 --- a/layouts/shortcodes/lazyimg-row.html +++ /dev/null @@ -1,3 +0,0 @@ -<p> - <img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholderRow }}" data-src="{{ index .Params 1 }}" alt="{{ index .Params 0 }}" /> -</p>
\ No newline at end of file diff --git a/layouts/shortcodes/lazyimg.html b/layouts/shortcodes/lazyimg.html deleted file mode 100644 index ff36b35..0000000 --- a/layouts/shortcodes/lazyimg.html +++ /dev/null @@ -1,3 +0,0 @@ -<p> - <img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholder }}" data-src="{{ index .Params 1 }}" alt="{{ index .Params 0 }}" /> -</p>
\ No newline at end of file |