🎨 Upgrade Hugo min version is 134 & add read more feature

This commit is contained in:
elkan1788
2024-12-08 17:01:27 +08:00
parent c4649b8284
commit f7f5311e6f
8 changed files with 22 additions and 18 deletions

View File

@@ -1,17 +1,15 @@
{{/* Use to defind global variables */}}
{{ $version := int (index (split hugo.Version ".") 1) }}
{{ if lt $version 89 }}
{{ warnf "当前 Hugo 版本小于 0.89.0,请到官方地址下载 Hugo 最新版本https://github.com/gohugoio/hugo/releases" }}
{{ errorf "Current Hugo version is less then 0.89.0, Please download Hugo latest version on offical site: https://github.com/gohugoio/hugo/releases" }}
{{ end }}
{{ $majorVer := int (index (split hugo.Version ".") 1) }}
{{ if lt $majorVer 134 }}
{{ errorf "当前 Hugo 版本为 %s 小于 0.134.0,请到官方地址下载 Hugo 最新版本https://github.com/gohugoio/hugo/releases" hugo.Version }}
{{ errorf "Current Hugo version is %s less then 0.134.0, Please download the Hugo latest version from offical site: https://github.com/gohugoio/hugo/releases" hugo.Version }}
{{ end }}
{{ 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" }}
{{ errorf "Hugo NexT 主题使用了 SCSS 框架,请到官方地址下载 Hugo Extended 版本https://github.com/gohugoio/hugo/releases" }}
{{ errorf "Because that use SCSS framework in Hugo NexT, Please download the Hugo extended version from offical site: https://github.com/gohugoio/hugo/releases" }}
{{ end }}
{{ $globalVars := newScratch }}
{{ $pages := (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections) }}

View File

@@ -6,6 +6,9 @@
{{ .Summary }}
{{ end }}
{{ else }}
{{ .Content }}
{{/** Started use the read more content anchor the need Hugo framework min marjo version greater than 0.134.0 **/}}
{{ .Summary }}
<a id="more"><!-- It's an anchor point to locate read more content start. --></a>
{{ .ContentWithoutSummary }}
{{ end }}
{{ end }}