🚧 optimization some module design.

This commit is contained in:
凡梦星尘 2022-07-02 22:22:46 +08:00
parent a758a6bb3f
commit a2f296601d
12 changed files with 60 additions and 45 deletions

View File

@ -1,4 +1,4 @@
# Hugo theme of NexT
# Hugo NexT
![hugo-next-primary](https://lisenhui.gitee.io/imgs/hugo-next/logo/hugo-next-primary.png)

View File

@ -761,7 +761,7 @@ params:
serverURL: #<your waline server url>
# Artalk 评论插件
# 更多配置信息请参考:
# 更多配置信息请参考:https://artalk.js.org
# Artalk comments system
# More info see: https://artalk.js.org
artalk:
@ -801,16 +801,16 @@ params:
giscus:
# Github 仓库地址,格式:用户名/仓库名称
# Github repository owner and name
repo: hugo-next/hugo-theme-next
repo: username/repo_name
# Giscus 生成的仓库 Id
# Generate repository Id from Giscus
repoId: R_kgDOHRjXGA
repoId: #<repo_id>
# 讨论区的分类名称
# Github discussions category
category: Comments
category: Announcements
# 讨论区分类 ID
# Generate category Id from Giscus
categoryId: DIC_kwDOHRjXGM4CP8S4
categoryId: #<category_id>
# 讨论区帖子标题,可选值: pathname | url | title | og:title | 自定义
# Available values: pathname | url | title | og:title | custom
mapping: title
@ -848,11 +848,12 @@ params:
# Statistics and Analytics
# ---------------------------------------------------------------
# 51La站点统计
# 更多信息请参考https://invite.51.la/1NUfGTS1?target=V6
# 51La Analytics
# See: https://invite.51.la/1NUfGTS1?target=V6
laId: # <app_id>
analytics:
# 51La 站点统计
# 更多信息请参考https://invite.51.la/1NUfGTS1?target=V6
# 51La Analytics
# See: https://invite.51.la/1NUfGTS1?target=V6
laId: #<anaytics_id>
# TODO
# Show Views / Visitors of the website / page with busuanzi.
@ -1029,6 +1030,4 @@ params:
# The js option is only valid when vendors.internal is local.
css: css
js: js
images: imgs
images: imgs

View File

@ -12,7 +12,7 @@ next() {
██║ ╚████║███████╗██╔╝ ██╗ ██║
╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝
========================================
NexT version $1
Hugo NexT version $1
Documentation: https://hugo-next.eu.org
========================================
EOT

View File

@ -1,22 +1,8 @@
{{- .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 -}}
{{- partial "init.html" . -}}
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
{{ 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 }}">
{{- partial "head.html" . }}
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
<noscript>
@ -48,11 +34,11 @@
</main>
<footer class="footer">
<div class="footer-inner">
{{- partial "footer" . }}
{{- partial "footer.html" . }}
</div>
</footer>
{{- partial "scripts" . }}
{{- partialCached "scripts.html" . }}
</body>
</html>

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

@ -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,6 +21,9 @@
{{- $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 }}">
{{- if .IsPage }}
<style type="text/css">

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

@ -40,4 +40,7 @@
{{- $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

@ -6,7 +6,7 @@ homepage = "https://github.com/hugo-next/hugo-theme-next"
tags = ["blog", "simple", "dark", "personal", "fast", "theme"]
features = ["some", "awesome", "features"]
min_version = "0.86.0"
demosite = "https://lisenhui.cn"
demosite = "https://preview.hugo-next.eu.org"
[author]
name = "lisenhui"