summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/_markup/render-image.html4
-rw-r--r--layouts/_default/index.json5
-rw-r--r--layouts/_default/search.html39
-rw-r--r--layouts/_default/single.html10
-rw-r--r--layouts/partials/analytic-cfga.html2
-rw-r--r--layouts/partials/head.html14
-rw-r--r--layouts/partials/post-meta.html2
-rw-r--r--layouts/partials/scripts-end.html28
-rw-r--r--layouts/partials/sidebar.html11
-rw-r--r--layouts/partials/styles.html13
-rw-r--r--layouts/shortcodes/img-lazy.html32
-rw-r--r--layouts/shortcodes/img-nz-lazy.html25
-rw-r--r--layouts/shortcodes/img-nz.html7
13 files changed, 118 insertions, 74 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index b9020c7..1b20943 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -1 +1,3 @@
-<img class="img-zoomable" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" /> \ No newline at end of file
+<a href="{{ .Destination | safeURL }}" target="_blank">
+ <img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />
+</a> \ No newline at end of file
diff --git a/layouts/_default/index.json b/layouts/_default/index.json
new file mode 100644
index 0000000..e582dda
--- /dev/null
+++ b/layouts/_default/index.json
@@ -0,0 +1,5 @@
+{{- $.Scratch.Add "search" slice -}}
+{{- range (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) -}}
+ {{- $.Scratch.Add "search" (dict "title" .Title "tags" .Params.tags "content" .Plain "permalink" .Permalink "date" (.Date.Format "2006-01-02")) -}}
+{{- end -}}
+{{- $.Scratch.Get "search" | jsonify -}} \ No newline at end of file
diff --git a/layouts/_default/search.html b/layouts/_default/search.html
new file mode 100644
index 0000000..8948e45
--- /dev/null
+++ b/layouts/_default/search.html
@@ -0,0 +1,39 @@
+{{ define "main" }}
+<!-- search form -->
+<div class="page-info">
+ <form class="search-form" method="GET">
+ <div class="search-input">
+ <input name="s" type="search" autocapitalize="off" autocomplete="off" autocorrect="off"
+ spellcheck="false" />
+ <button type="submit"><ion-icon name="search-circle-outline"></ion-icon></button>
+ </div>
+ </form>
+</div>
+<!-- search result and template -->
+<div class="search-result-info" style="display: none;"><span>{{ i18n "searchSuccess" }}</span></div>
+<div class="search-result-info" style="display: none;"><span>{{ i18n "searchNotFound" }}</span></div>
+<div class="search-result-info" style="display: none;"><span>{{ i18n "searchFailed" }}</span></div>
+<div id="search-result"></div>
+<script id="search-result-template" type="text/fuse-template">
+ {{ "<% for(var i = 0; i < $data.length; i++){ %>" | safeHTML }}
+ <div class="post">
+ <h3 class="post-item post-title-archive">
+ <a href="<%= $data[i].item.permalink %>">{{ "<%= $data[i].item.title %>" | safeHTML }}</a>
+ </h3>
+ <div class="post-item post-meta-archive">
+ <span><ion-icon name="today"></ion-icon>&nbsp;{{- "<%= $data[i].item.date %>" | safeHTML -}}</span>
+ <span>
+ <ion-icon name="pricetags"></ion-icon>&nbsp;
+ {{- "<% if ($data[i].item.tags && $data[i].item.tags.length > 0) { %>" | safeHTML -}}
+ {{- "<% for(var j = 0; j < $data[i].item.tags.length; j++){ %>" | safeHTML -}}
+ {{- "<%= $data[i].item.tags[j] %>&nbsp;" | safeHTML -}}
+ {{- "<% } %>" | safeHTML -}}
+ {{- "<% } else { %>" | safeHTML -}}
+ {{- i18n "postMetaNoTag" -}}
+ {{- "<% } %>" | safeHTML }}
+ </span>
+ </div>
+ </div>
+ {{ "<% } %>" | safeHTML }}
+</script>
+{{ end }} \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index db5e2f5..8f7eb35 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -7,7 +7,7 @@
<div class="post-item post-meta">
{{ partial "post-meta.html" . }}
</div>
- {{ with .Params.playerURL }}
+ {{ with .Params.player }}
<div id="post-aplayer"></div>
{{ end }}
<!-- post main content -->
@@ -16,7 +16,7 @@
</div>
</article>
<!-- post license -->
-{{ if and (.Site.Params.showLicense) (ne .Params.noLicense true) }}
+{{ if and (or .Site.Params.showLicense .Params.showLicense) (ne .Params.showLicense false) }}
<div class="license markdown-body">
<blockquote>
<p>{{ i18n "postCopyrightFront" }}<a rel="license" href="{{ .Site.Params.licenseLink }}"
@@ -24,11 +24,11 @@
</blockquote>
</div>
{{ end }}
-{{ if .Site.Params.disqusJSApi }}
+{{ if and (.Site.Params.disqusJSApi) (ne .Params.showComments false) }}
{{ partial "comment-disqusjs.html" . }}
-{{ else if .Site.Params.disqusShortname }}
+{{ else if and (.Site.Params.disqusShortname) (ne .Params.showComments false) }}
{{ partial "comment-disqus.html" . }}
-{{ else if .Site.Params.utterancesRepo }}
+{{ else if and (.Site.Params.utterancesRepo) (ne .Params.showComments false) }}
{{ partial "comment-utterances.html" . }}
{{ else }}{{ end }}
{{ end }} \ No newline at end of file
diff --git a/layouts/partials/analytic-cfga.html b/layouts/partials/analytic-cfga.html
index 63db4d6..d1e52af 100644
--- a/layouts/partials/analytic-cfga.html
+++ b/layouts/partials/analytic-cfga.html
@@ -3,5 +3,5 @@
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>
+<script async src="https://cdn.jsdelivr.net/npm/cfga@1.0.3/cfga.min.js"></script>
{{ end }} \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 0603c4d..1bcdf85 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -9,7 +9,6 @@
<!-- favicon -->
{{ partial "favicon.html" . }}
-
<!-- seo metadata -->
{{ if and (.IsHome) (.Site.Params.subTitle) }}
<title>{{ .Site.Title }} - {{ .Site.Params.subTitle }}</title>
@@ -22,17 +21,15 @@
<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 }}" />
+<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" . }}
-
<!-- dep -->
+{{ partial "styles.html" . }}
{{ if .Site.Params.useHugoPipes }}
{{ $options := (dict "targetPath" "assets/css/fuji-custom.min.css" "outputStyle" "compressed") }}
{{ $style := resources.Get "scss/fuji.scss" | resources.ToCSS $options }}
@@ -40,13 +37,14 @@
{{ else }}
<link rel="stylesheet" href="{{ "/assets/css/fuji.min.css" | relURL }}" />
{{ end }}
-
-{{ if .Params.playerURL }}
+{{ with .Site.Params.googleAdsense }}
+<script async data-ad-client="ca-pub-{{ . }}" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
+{{ end}}
+{{ if .Params.player }}
<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 }}
-
{{ partial "analytic-gtag.html" . }}
{{ partial "analytic-cfga.html" . }} \ No newline at end of file
diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html
index 5176053..3e366e7 100644
--- a/layouts/partials/post-meta.html
+++ b/layouts/partials/post-meta.html
@@ -1 +1 @@
-<span><ion-icon name="today"></ion-icon></ion-icon>&nbsp;{{ .Date.Format "2006-01-02" }}</span>{{ if .Site.Params.showWordCounter }}<span><ion-icon name="file-tray"></ion-icon>&nbsp;{{ .WordCount }}{{ i18n "postMetaWordCount" }}</span>{{ end }}{{ if .Site.Params.showReadTime }}<span><ion-icon name="stopwatch"></ion-icon>&nbsp;{{ .ReadingTime }}{{ i18n "postMetaReadingTime" }}</span>{{ end }}<span><ion-icon name="pricetags"></ion-icon>&nbsp;{{ if .Params.tags }}{{ range .Params.tags }}<a href="{{ "/tags/" | relURL }}{{ . | urlize}}">{{ . }}</a>&nbsp;{{ end }}{{ else }}{{ i18n "postMetaNoTag" }}{{ end }}</span> \ No newline at end of file
+<span><ion-icon name="today"></ion-icon>&nbsp;{{ .Date.Format "2006-01-02" }}</span>{{ if .Site.Params.showWordCounter }}<span><ion-icon name="file-tray"></ion-icon>&nbsp;{{ .WordCount }}{{ i18n "postMetaWordCount" }}</span>{{ end }}{{ if .Site.Params.showReadTime }}<span><ion-icon name="stopwatch"></ion-icon>&nbsp;{{ .ReadingTime }}{{ i18n "postMetaReadingTime" }}</span>{{ end }}<span><ion-icon name="pricetags"></ion-icon>&nbsp;{{ if .Params.tags }}{{ range .Params.tags }}<a href="{{ "/tags/" | relURL }}{{ . | urlize}}">{{ . }}</a>&nbsp;{{ 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
index 862e0e2..37311b7 100644
--- a/layouts/partials/scripts-end.html
+++ b/layouts/partials/scripts-end.html
@@ -1,27 +1,35 @@
<script async type="module" src="https://cdn.jsdelivr.net/npm/ionicons@5.0.1/dist/ionicons/ionicons.esm.js"></script>
<script async nomodule src="https://cdn.jsdelivr.net/npm/ionicons@5.0.1/dist/ionicons/ionicons.js"></script>
+{{ if eq .Section "search" }}
+<script defer src="https://cdn.jsdelivr.net/combine/npm/art-template@4.13.2/lib/template-web.min.js,npm/fuse.js@6.2.0"></script>
+{{ else if eq .Section "archives" }}
+{{ else }}
<script defer src="https://cdn.jsdelivr.net/npm/prismjs@1.20.0/components/prism-core.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/prismjs@1.20.0/plugins/autoloader/prism-autoloader.min.js"></script>
-
<script defer src="https://cdn.jsdelivr.net/npm/lazysizes@5.2.2/lazysizes.min.js"></script>
-<script defer src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.5/dist/medium-zoom.min.js"></script>
+{{ end }}
<script defer src="{{ "/assets/js/fuji.min.js" | relURL }}"></script>
-
-{{ with .Params.playerURL }}
+{{ with .Params.player }}
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
+<!-- prettier-ignore -->
<script>
// in-post aplayer
+ /* beautify preserve:start */
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 }}'
- }]
+ listFolded: true,
+ audio: [{{- range $.Params.player -}}
+ {
+ name: '{{ .playerName }}',
+ artist: '{{ .playerArtist }}',
+ url: '{{ .playerURL }}',
+ cover: '{{ .playerCover }}'
+ },
+ {{- end -}}]
});
+ /* beautify preserve:end */
// aplayer toc anchors fix
// see https://github.com/MoePlayer/APlayer/issues/242#issuecomment-602471423
document.addEventListener('DOMContentLoaded', function () {
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 7ead0e2..af737ce 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -1,11 +1,13 @@
<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)) }}
+ {{ if in .Site.Params.mainSections .Type }}
+ {{ if and (or .Site.Params.showToc .Params.showToc) (ne .Params.showToc false) }}
<div class="sidebar-item sidebar-toc">
<h3>{{ i18n "sidebarToc" }}</h3>
{{ .TableOfContents }}
</div>
{{ end }}
+ {{ end }}
<!-- pages -->
<div class="sidebar-item sidebar-pages">
<h3>{{ i18n "sidebarPages" }}</h3>
@@ -15,9 +17,6 @@
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
- <li>
- <a href="{{ "/index.xml" | relURL }}" target="_blank">RSS</a>
- </li>
</ul>
</div>
<!-- tags -->
@@ -46,8 +45,8 @@
<!-- 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 图像榜单" />
+ <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/partials/styles.html b/layouts/partials/styles.html
new file mode 100644
index 0000000..cc6d930
--- /dev/null
+++ b/layouts/partials/styles.html
@@ -0,0 +1,13 @@
+{{ if ne .Site.Params.disableDarkImage true }}
+<style>
+ @media (prefers-color-scheme: dark) {
+ body[data-theme='auto'] img {
+ filter: brightness(60%);
+ }
+ }
+
+ body[data-theme='dark'] img {
+ filter: brightness(60%);
+ }
+</style>
+{{ end }} \ No newline at end of file
diff --git a/layouts/shortcodes/img-lazy.html b/layouts/shortcodes/img-lazy.html
index fef9bd3..e57b8fb 100644
--- a/layouts/shortcodes/img-lazy.html
+++ b/layouts/shortcodes/img-lazy.html
@@ -1,10 +1,22 @@
-{{ 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
+{{- if len .Params | eq 2 -}}
+<p>
+ <a href="{{ index .Params 1 | safeURL }}" target="_blank">
+ <img class="lazyload" src="{{ .Site.Params.lazyPlaceholder | relURL }}"
+ data-src="{{ index .Params 1 | safeURL }}" alt="{{ index .Params 0 }}" />
+ </a>
+</p>
+{{- else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" -}}
+<p>
+ <a href="{{ index .Params 2 | safeURL }}" target="_blank">
+ <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderRow | relURL }}"
+ data-src="{{ index .Params 2 | safeURL }}" alt="{{ index .Params 1 }}" />
+ </a>
+</p>
+{{- else if eq (index .Params 0) "col" -}}
+<p>
+ <a href="{{ index .Params 2 | safeURL }}" target="_blank">
+ <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderCol | relURL }}"
+ data-src="{{ index .Params 2 | safeURL }}" alt="{{ index .Params 1 }}" />
+ </a>
+</p>
+{{- 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
deleted file mode 100644
index bfdb26a..0000000
--- a/layouts/shortcodes/img-nz-lazy.html
+++ /dev/null
@@ -1,25 +0,0 @@
-{{ 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
deleted file mode 100644
index 1b4f791..0000000
--- a/layouts/shortcodes/img-nz.html
+++ /dev/null
@@ -1,7 +0,0 @@
-{{ 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