Merge branch 'release'

This commit is contained in:
凡梦星尘
2022-07-03 10:42:36 +08:00
58 changed files with 1321 additions and 1063 deletions

View File

@@ -1,4 +1,2 @@
{{- with .Site.Params.laId }}
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script charset="UTF-8" id="LA_COLLECT" src="https://sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({id: "{{ . }}",ck: "{{ . }}",autoTrack:true})</script>
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- with .Site.Params.artalk }}
<link href="//unpkg.com/artalk@2.3.4/dist/Artalk.css" rel="stylesheet">
<script src="//unpkg.com/artalk@2.3.4/dist/Artalk.js"></script>
<!-- Artalk -->
<div id="Comments"></div>
<script>
new Artalk({
el : '#Comments',
pageKey : '{{ $.Page.RelPermalink }}',
pageTitle : '{{ $.Page.Title }}',
server : '{{ .server }}',
site : '{{ .site }}',
locale : 'auto',
placeholder : '{{ .placeholder }}'
})
</script>
{{- end }}

View File

@@ -0,0 +1,3 @@
<div class="comment-loading">
<i class="fa fa-sync fa-spin"></i>
</div>

View File

@@ -0,0 +1,19 @@
{{- with .Site.Params.giscus }}
{{ printf "%t" (isset . "repo") }}
<div class="giscus" style="position: relative;"></div>
<script src="https://giscus.app/client.js"
data-repo="{{ .repo }}"
data-repo-id="{{ .repoId }}"
data-category="{{ .category }}"
data-category-id="{{ .categoryId }}"
data-mapping="{{ .mapping }}"
data-reactions-enabled="0"
data-emit-metadata="1"
data-input-position="{{ .inputPosition }}"
data-theme="{{ .theme }}"
data-lang="{{ $.Site.LanguageCode }}"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
{{- end }}

View File

@@ -1,5 +1,5 @@
{{- with .Site.Params.utterances }}
<script src="https://utterances.njilc.com/client.js"
<script src="https://utteranc.es/client.js"
repo="{{ .repo }}"
issue-term="{{ .issueTerm }}"
label="{{ .label }}"

View File

@@ -9,13 +9,15 @@
};
Waline.init({
locale,
el: "#waline",
emoji: {{ .emoji }},
imageUploader: {{ .imgUploader }},
wordLimit: {{ .wordLimit }},
requiredMeta: {{ .requiredMeta }},
serverURL: "{{ .serverURL }}",
lang: "{{ $.Lang }}"
el : "#waline",
pageview : {{ .pageView }},
emoji : {{ .emoji }},
imageUploader : {{ .imgUploader }},
wordLimit : {{ .wordLimit }},
requiredMeta : {{ .requiredMeta }},
serverURL : "{{ .serverURL }}",
lang : "{{ $.Lang }}",
dark : "auto"
});
</script>
{{- end }}
{{- end }}

View File

@@ -28,11 +28,15 @@
{{- if $tc }}
{{- range $sn }}
<div>
{{- partial "_thirdparty/comment/comm_loading.html" . }}
{{- partial (printf $cp (lower .name)) $root }}
</div>
{{- end }}
{{- else }}
<div>{{- partial (printf $cp $fc) $root }}</div>
<div>
{{- partial "_thirdparty/comment/comm_loading.html" . }}
{{- partial (printf $cp $fc) $root }}
</div>
{{- end }}
</div>
</div>

View File

@@ -48,8 +48,8 @@
{{- end }}
-->
*/}}
{{- if .Site.Params.busuanzi.enable }}
{{ with .Site.Params.busuanzi }}
{{- with .Site.Params.busuanzi }}
{{- if .enable }}
<div class="busuanzi-count">
{{- if .visitors }}
<span class="post-meta-item" id="busuanzi_container_site_uv" title="{{ T "VisitorsLabel" }}">
@@ -76,12 +76,12 @@
{{- end }}
{{- if $ft.powered }}
<div class="powered-by">
{{ $pb := printf "<a href='https://gohugo.io' target='_blank'>Hugo</a> &amp; <a href='https://github.com/hugo-next' target='_blank'>NexT.%s</a>" .Site.Params.scheme }}
{{ $pb := printf "<a href='https://gohugo.io' target='_blank'>Hugo</a> &amp; <a href='https://github.com/hugo-next/hugo-theme-next' target='_blank'>Hugo NexT.%s</a>" .Site.Params.scheme }}
{{- printf (T "FooterPowerby") $pb | safeHTML }}
</div>
{{- end }}
{{- if $ft.beian.enable }}
{{- with $ft.beian }}
{{- if .enable }}
<div class="beian">
<a href="https://beian.miit.gov.cn" target="_blank">{{ .icp }}</a>
<img src="/imgs/gongan.png" alt="{{ .provinceAbbr }}公网安备">
@@ -90,12 +90,12 @@
{{- end }}
{{- end }}
{{- with $ft.vendors }}
{{ if .enable }}
<div class="vendors-list">
{{- range .list }}
<a target="_blank" href="{{ .link }}" title="{{ .name }}">
{{- if .img }}
{{ $img := split .img "||" }}
<img src="{{- trim (index $img 0) " " }}" width="{{- trim (index $img 1) " " -}}px" alt="{{ .name }}" />
{{- if .image }}
<img src="{{ .image.url }}" alt="{{ .name }}" />
{{- else }}
{{ .name }}
{{- end }}
@@ -103,4 +103,5 @@
{{- end }}
<span>{{ .title }}</span>
</div>
{{- end }}
{{- end }}

View File

@@ -3,6 +3,6 @@
{{- partial "head/twitter.html" . }}
{{- partial "head/googleplus.html" . }}
{{- partial "head/facebook.html" . }}
{{ partial "head/verify.html" . }}
{{- partial "head/style.html" . }}
{{- partial "head/analytics.html" . }}
{{- partial "head/verify.html" . }}
{{- partialCached "head/style.html" . }}
{{- partialCached "head/analytics.html" . }}

View File

@@ -1 +1,5 @@
{{- partial "_thirdparty/analytics/51la.html" . }}
{{- with .Site.Params.analytics }}
{{- if isset . "laid" }}
{{ partial "_thirdparty/analytics/51la.html" .laId }}
{{- end }}
{{- end }}

View File

@@ -1,3 +1,16 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
{{- if .Site.Params.darkmode }}
<meta name="theme-color" content="{{ .Site.Params.themeColor.dark }}" media="(prefers-color-scheme: dark)" />
{{- else }}
<meta name="theme-color" content="{{ .Site.Params.themeColor.light }}" media="(prefers-color-scheme: light)" />
{{- end }}
{{ hugo.Generator }}
<link rel="shortcut icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}">
<link rel="icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ .Site.Params.favicon.small }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.favicon.medium }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ .Site.Params.favicon.appleTouchIcon }}">
<meta itemprop="name" content="{{ .Title }}" />
<meta itemprop="description" content="{{ .Description | default .Site.Params.description }}" />
{{- if .IsPage }}
@@ -15,8 +28,3 @@
{{- .Scratch.Set "metaImg" $img }}
<meta itemprop="image" content="{{ $img | absURL }}" />
<meta itemprop="keywords" content="{{ if and .IsPage (isset .Params "tags")}}{{ delimit .Params.tags "," }}{{ else }}{{ .Site.Params.keywords }}{{ end }}" />
{{- if .Site.Params.darkmode }}
<meta name="theme-color" content="{{ .Site.Params.themeColor.dark }}" media="(prefers-color-scheme: dark)" />
{{- else }}
<meta name="theme-color" content="{{ .Site.Params.themeColor.light }}" media="(prefers-color-scheme: light)" />
{{- end }}

View File

@@ -21,8 +21,10 @@
{{- $scss := resources.Get "css/main.scss" }}
{{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }}
{{- $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }}
{{- if hugo.IsProduction }}
{{- $css = $css | minify | fingerprint }}
{{- end }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
<link rel="stylesheet" href="/css/hover.css">
{{- if .IsPage }}
<style type="text/css">
.post-footer hr:after {

View File

@@ -2,13 +2,12 @@
{{- $curP := .Page }}
<nav class="site-nav">
<ul class="main-menu menu">
{{- range $curP.Site.Menus.main }}
{{- $active := or ($curP.IsMenuCurrent "main" .) ($curP.HasMenuCurrent "main" .) }}
{{- $active = or $active (eq .URL "/")}}
{{- range .Site.Menus.main }}
{{- $active := $curP.IsMenuCurrent "main" . }}
<li class="menu-item menu-item-{{ .Identifier }}">
<a href="{{ .URL | relLangURL }}" class="hvr-icon-pulse {{if $active }} menu-item-active{{ end }}" rel="section">
{{- if $ms.icons }}<i class="fa fa-{{ .Pre }} hvr-icon"></i>{{ end }}{{- .Name }}
{{- if and $ms.badges (eq .Identifier "archives" ) }}
{{- if and $ms.badges (eq .Identifier "archives") }}
<span class="badge">{{ $.Scratch.Get "postsCount" }}</span>
{{- end }}
</a>

View File

@@ -0,0 +1,14 @@
{{/* Use to defind global variables */}}
{{- if not hugo.IsExtended }}
{{- warnf "Hugo NexT 主题使用了 SCSS 框架,请到官方地址下载 Hugo Extended 版本https://github.com/gohugoio/hugo/releases" -}}
{{- errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" -}}
{{- end }}
{{- .Scratch.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) -}}
{{- .Scratch.Set "catsCount" (len .Site.Taxonomies.categories) -}}
{{- .Scratch.Set "tagsCount" (len .Site.Taxonomies.tags) -}}
{{- $vendors := .Site.Data.resources.vendors -}}
{{- $pluginVen := .Site.Params.vendors.plugins -}}
{{- $pluginCDN := index $vendors $pluginVen -}}
{{- .Scratch.Set "pluginCDN" $pluginCDN -}}

View File

@@ -21,7 +21,7 @@
<a target="_blank" href="{{ .Params.OriginLink }}" title="{{ .Title }}">{{ .Params.Link }}</a>
{{- else }}
<strong>{{ print (T "PostCRLink") (T "SymbolColon") }}</strong>
<a href="{{ .Permalink | absLangURL }}" title="{{ .Title }}">{{ .Permalink | absLangURL }}</a>
<a id="post-cr-link" href="{{ .Permalink | absLangURL }}" title="{{ .Title }}">{{ .Permalink | absLangURL }}</a>
{{- end }}
</li>
<li class="post-copyright-license">

View File

@@ -6,7 +6,7 @@
{{- T "RewardDonate" -}}
</button>
<div class="post-reward">
{{- range $name,$img := $.Site.Params.reward }}
{{- range $name,$img := .reward }}
{{- $fw := substr $name 0 1 }}
{{- $pay := replace $name $fw ($fw | upper) 1 }}
{{- $payName := T (printf "Reward%s" $pay) }}

View File

@@ -1,27 +1,19 @@
{{- $pageViewCls := "" }}
{{- if .Site.Params.leancloudVisitors.enable }}
<span id="{{ .Permalink }}" class="post-meta-item leancloud_visitors" data-flag-title="{{ .Title }}" title="{{ T "PostViews" }}">
<span class="post-meta-item-icon">
<i class="far fa-eye"></i>
</span>
<span class="post-meta-item-text">{{- print (T "PostViews") (T "SymbolColon") -}}</span>
<span class="leancloud-visitors-count"></span>
</span>
{{- $pageViewCls = "leancloud-visitors-count" }}
{{- end }}
{{- if and .Site.Params.waline.enable .Site.Params.waline.pageView }}
{{- $pageViewCls = "waline-pageview-count" }}
{{- end }}
{{- if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.postViews }}
{{- $pageViewCls = "busuanzi_value_page_pv" }}
{{- end }}
{{- if .Site.Params.firestore.enable }}
<span class="post-meta-item" title="{{ T "PostViews" }}">
<span class="post-meta-item-icon">
<i class="far fa-eye"></i>
</span>
<span class="post-meta-item-text">{{ print (T "PostViews") (T "SymbolColon") }}</span>
<span class="firestore-visitors-count"></span>
</span>
{{- end }}
{{- if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.postViews }}
<span class="post-meta-item" title="{{ T "PostViews" }}" id="busuanzi_container_page_pv">
<span class="post-meta-item-icon">
<i class="{{ .Site.Params.busuanzi.postViewsIcon }}"></i>
<span class="post-meta-item-text">
{{ print (T "PostViews") (T "SymbolColon") }}
</span>
<span class="post-meta-item-text">{{ print (T "PostViews") (T "SymbolColon") }}</span>
<span id="busuanzi_value_page_pv"><i class="fa fa-sync fa-spin"></i></span>
<span class="{{ $pageViewCls }}" data-path="{{ .RelPermalink | relLangURL }}"><i class="fa fa-sync fa-spin"></i></span>
</span>
{{- end }}

View File

@@ -15,83 +15,32 @@
{{- $pluginJS = replace $pluginJS "${name}" $npm }}
{{- $pluginJS = replace $pluginJS "${version}" $js.version }}
{{- $pluginJS = replace $pluginJS "${file}" $file }}
<script type="text/javascript" src="{{ $pluginJS }}"></script>
<script type="text/javascript" src="{{ $pluginJS }}" defer></script>
{{- end }}
<script class="next-config" data-name="main" type="application/json">
{
"hostname": "theme-next.js.org",
"root": "/",
"images": "/images",
"scheme": "Gemini",
"darkmode": true,
"version": "8.12.1",
"exturl": true,
"sidebar":
{
"position": "left",
"display": "post",
"padding": 18,
"offset": 12
},
"copycode":
{
"enable": true,
"style": "default"
},
"bookmark":
{
"enable": false,
"color": "#222",
"save": "auto"
},
"mediumzoom": true,
"lazyload": false,
"pangu": false,
"comments":
{
"style": "tabs",
"active": null,
"storage": true,
"lazyload": true,
"nav": null
},
"stickytabs": false,
"motion":
{
"enable": false,
"async": false,
"transition":
{
"post_block": "fadeIn",
"post_header": "fadeInDown",
"post_body": "fadeInDown",
"coll_header": "fadeInLeft",
"sidebar": "fadeInUp"
}
},
"prism": false,
"i18n":
{
"placeholder": "Searching...",
"empty": "We didn't find any results for the search: ${query}",
"hits_time": "${hits} results found in ${time} ms",
"hits": "${hits} results found"
},
"path": "/search.json",
"localsearch":
{
"enable": true,
"trigger": "auto",
"top_n_per_article": 1,
"unescape": false,
"preload": false
}
}
</script>
{{ $config := resources.Get "js/config.js" }}
{{ $boot := resources.Get "js/next-boot.js" }}
{{ $utils := resources.Get "js/utils.js" }}
{{ $alljs := (slice $config $boot $utils) | resources.Concat "js/all.js"}}
<script defer src="{{ $alljs.RelPermalink }}"></script>
{{- $config := resources.Get "js/config.js" | resources.ExecuteAsTemplate "config.js" . }}
{{- $motion := resources.Get "js/motion.js" }}
{{- $boot := resources.Get "js/next-boot.js" }}
{{- $utils := resources.Get "js/utils.js" }}
{{- $nextjs := (slice $config $utils $boot ) }}
{{- if .Site.Params.motion.enable }}
{{ $motionjs := resources.Get "js/motion.js" }}
{{ $nextjs = $nextjs | append $motionjs }}
{{- end }}
{{- if or (eq .Site.Params.shceme "Muse") (eq .Site.Params.shceme "Mist") }}
{{ $musejs := resources.Get "js/schemes/muse.js" }}
{{ $nextjs = $nextjs | append $musejs }}
{{- end }}
{{- if .Site.Params.bookmark.enable }}
{{- $bookmarkjs := resources.Get "js/bookmark.js" }}
{{- $nextjs = $nextjs | append $bookmarkjs }}
{{- end }}
{{- if .Site.Params.pjax }}
{{- $pjaxjs := resources.Get "js/pjax.js" }}
{{- $nextjs = $nextjs | append $pjaxjs }}
{{- end }}
{{- $nextjs = $nextjs | resources.Concat "js/hugo-next.js"}}
{{ if hugo.IsProduction }}
{{- $nextjs = $nextjs | minify | fingerprint }}
{{ end }}
<script type="text/javascript" src="{{ $nextjs.RelPermalink }}" defer></script>

View File

@@ -60,11 +60,10 @@
{{- end }}
</div>
{{- $lang := .Scratch.Get "lang" }}
{{- with .Site.Params.creativeCommons }}
{{- if .sidebar }}
<div class="cc-license animated" itemprop="license">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.{{ substr $lang 0 2 }}" class="cc-opacity" rel="noopener" target="_blank" title="{{ T "CCLinkTitle" }}">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.{{ substr $.Site.LanguageCode 0 2 }}" class="cc-opacity" rel="noopener" target="_blank" title="{{ T "CCLinkTitle" }}">
<img src="/imgs/cc/{{ .size }}/{{ replace .license "-" "_" }}.svg" alt="{{ T "CCLinkTitle" }}">
</a>
</div>