🎨 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

@ -10,7 +10,7 @@
> All page designs & configuration compatibility with Hexo NexT, it's very easy migrate your site from Hexo to Hugo and enjoy yourself. > All page designs & configuration compatibility with Hexo NexT, it's very easy migrate your site from Hexo to Hugo and enjoy yourself.
[![Gitter](https://img.shields.io/gitter/room/hugo-next/hugo-them-next?logo=gitter&style=flat-square&label=Gitter)](https://app.gitter.im/#/room/#hugo-next_community:gitter.im) [![Build Hugo Version](https://img.shields.io/badge/Hugo-%3E=0.89.0-red?style=flat-square&logo=hugo&color=%23FF4088&&label=Hugo%20Extended)](https://github.com/gohugoio/hugo/releases/latest) [![GitHub deployments](https://img.shields.io/github/deployments/hugo-next/hugo-next.github.io/github-pages?style=flat-square&logo=GitHub&label=Github%20Pages)](https://github.com/hugo-next/hugo-theme-next) [![Contributors](https://img.shields.io/github/contributors/hugo-next/hugo-theme-next?style=flat-square&color=%235E0D73&logo=contributorcovenant&label=Contributors)](https://github.com/hugo-next/hugo-theme-next/graphs/contributors) [![Latest Release](https://img.shields.io/github/v/release/hugo-next/hugo-theme-next?include_prereleases&style=flat-square&color=%23DD2C00&logo=semanticrelease&label=Latest%20Release)](https://github.com/hugo-next/hugo-theme-next/releases) [![Repos Size](https://img.shields.io/github/repo-size/hugo-next/hugo-theme-next?style=flat-square&color=%23FFBF3B&logo=Files&label=Repo%20Size)](https://github.com/hugo-next/hugo-theme-next/find/main) [![GitHub](https://img.shields.io/github/license/hugo-next/hugo-theme-next?logo=webauthn&style=flat-square&label=License)](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE) [![Gitter](https://img.shields.io/gitter/room/hugo-next/hugo-them-next?logo=gitter&style=flat-square&label=Gitter)](https://app.gitter.im/#/room/#hugo-next_community:gitter.im) [![Build Hugo Version](https://img.shields.io/badge/Hugo-%3E=0.134.0-red?style=flat-square&logo=hugo&color=%23FF4088&&label=Hugo%20Extended)](https://github.com/gohugoio/hugo/releases/latest) [![GitHub deployments](https://img.shields.io/github/deployments/hugo-next/hugo-next.github.io/github-pages?style=flat-square&logo=GitHub&label=Github%20Pages)](https://github.com/hugo-next/hugo-theme-next) [![Contributors](https://img.shields.io/github/contributors/hugo-next/hugo-theme-next?style=flat-square&color=%235E0D73&logo=contributorcovenant&label=Contributors)](https://github.com/hugo-next/hugo-theme-next/graphs/contributors) [![Latest Release](https://img.shields.io/github/v/release/hugo-next/hugo-theme-next?include_prereleases&style=flat-square&color=%23DD2C00&logo=semanticrelease&label=Latest%20Release)](https://github.com/hugo-next/hugo-theme-next/releases) [![Repos Size](https://img.shields.io/github/repo-size/hugo-next/hugo-theme-next?style=flat-square&color=%23FFBF3B&logo=Files&label=Repo%20Size)](https://github.com/hugo-next/hugo-theme-next/find/main) [![GitHub](https://img.shields.io/github/license/hugo-next/hugo-theme-next?logo=webauthn&style=flat-square&label=License)](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE)
![Screenshot](images/screenshot.png) ![Screenshot](images/screenshot.png)

View File

@ -10,7 +10,7 @@
> 本主题的所有页面设计和配置项都与原来 `Hexo` 引擎的 `NexT` 主题保持了良好的兼容性,可以非常平滑的从 `Hexo` 迁移至 `Hugo` 引擎,欢迎大家使用并反馈。 > 本主题的所有页面设计和配置项都与原来 `Hexo` 引擎的 `NexT` 主题保持了良好的兼容性,可以非常平滑的从 `Hexo` 迁移至 `Hugo` 引擎,欢迎大家使用并反馈。
[![Gitter](https://img.shields.io/gitter/room/hugo-next/hugo-them-next?logo=gitter&style=flat-square&label=Gitter)](https://app.gitter.im/#/room/#hugo-next_community:gitter.im) [![Build Hugo Version](https://img.shields.io/badge/Hugo-%3E=0.89.0-red?style=flat-square&logo=hugo&color=%23FF4088&&label=Hugo%20Extended)](https://github.com/gohugoio/hugo/releases/latest) [![GitHub deployments](https://img.shields.io/github/deployments/hugo-next/hugo-next.github.io/github-pages?style=flat-square&logo=GitHub&label=Github%20Pages)](https://github.com/hugo-next/hugo-theme-next) [![Contributors](https://img.shields.io/github/contributors/hugo-next/hugo-theme-next?style=flat-square&color=%235E0D73&logo=contributorcovenant&label=Contributors)](https://github.com/hugo-next/hugo-theme-next/graphs/contributors) [![Latest Release](https://img.shields.io/github/v/release/hugo-next/hugo-theme-next?include_prereleases&style=flat-square&color=%23DD2C00&logo=semanticrelease&label=Latest%20Release)](https://github.com/hugo-next/hugo-theme-next/releases) [![Repos Size](https://img.shields.io/github/repo-size/hugo-next/hugo-theme-next?style=flat-square&color=%23FFBF3B&logo=Files&label=Repo%20Size)](https://github.com/hugo-next/hugo-theme-next/find/main) [![GitHub](https://img.shields.io/github/license/hugo-next/hugo-theme-next?logo=webauthn&style=flat-square&label=License)](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE) [![Gitter](https://img.shields.io/gitter/room/hugo-next/hugo-them-next?logo=gitter&style=flat-square&label=Gitter)](https://app.gitter.im/#/room/#hugo-next_community:gitter.im) [![Build Hugo Version](https://img.shields.io/badge/Hugo-%3E=0.134.0-red?style=flat-square&logo=hugo&color=%23FF4088&&label=Hugo%20Extended)](https://github.com/gohugoio/hugo/releases/latest) [![GitHub deployments](https://img.shields.io/github/deployments/hugo-next/hugo-next.github.io/github-pages?style=flat-square&logo=GitHub&label=Github%20Pages)](https://github.com/hugo-next/hugo-theme-next) [![Contributors](https://img.shields.io/github/contributors/hugo-next/hugo-theme-next?style=flat-square&color=%235E0D73&logo=contributorcovenant&label=Contributors)](https://github.com/hugo-next/hugo-theme-next/graphs/contributors) [![Latest Release](https://img.shields.io/github/v/release/hugo-next/hugo-theme-next?include_prereleases&style=flat-square&color=%23DD2C00&logo=semanticrelease&label=Latest%20Release)](https://github.com/hugo-next/hugo-theme-next/releases) [![Repos Size](https://img.shields.io/github/repo-size/hugo-next/hugo-theme-next?style=flat-square&color=%23FFBF3B&logo=Files&label=Repo%20Size)](https://github.com/hugo-next/hugo-theme-next/find/main) [![GitHub](https://img.shields.io/github/license/hugo-next/hugo-theme-next?logo=webauthn&style=flat-square&label=License)](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE)
![截图](images/screenshot.png) ![截图](images/screenshot.png)

View File

@ -80,4 +80,9 @@
svg { svg {
max-width: 98%; max-width: 98%;
} }
// For read more post content anchor
#more {
visibility: hidden;
}
} }

View File

@ -28,7 +28,8 @@ languageCode: zh-CN
hasCJKLanguage: true hasCJKLanguage: true
# 每页显示文章数量 # 每页显示文章数量
# Display items per page # Display items per page
paginate: 10 pagination:
pagerSize: 10
# 开启支持表情符号 # 开启支持表情符号
# Enable Emoji support # Enable Emoji support
enableEmoji: true enableEmoji: true

View File

@ -20,8 +20,6 @@ toc: true
对于熟悉前端开发的用户来说可以通过自定义文件配置实现对站点的样式和布局进行个性化的调整。其中布局方面主要是支持左侧边栏的站点概览部分以及站点底部2个位置但样式的重置可以是整个站点的任意位置。 对于熟悉前端开发的用户来说可以通过自定义文件配置实现对站点的样式和布局进行个性化的调整。其中布局方面主要是支持左侧边栏的站点概览部分以及站点底部2个位置但样式的重置可以是整个站点的任意位置。
<!--more-->
## 打开配置参数 ## 打开配置参数
首先要明确在配置文件的 `params` 区域中有配置如下参数: 首先要明确在配置文件的 `params` 区域中有配置如下参数:
@ -65,7 +63,6 @@ Website source code <a href="https://github.com/hugo-next/hugo-theme-next/tree/d
再把该文件的路径配置到相应的参数中,效果请查看站点底部的效果。 再把该文件的路径配置到相应的参数中,效果请查看站点底部的效果。
## 自定义样式 ## 自定义样式
在前面创建 `css` 目录中新一个后缀名为 `css` 的文件,然后可以在里面把站点的样式进行重定义,或是增加一些自己定义的样式设计,在写文章时进行引用,示例如下: 在前面创建 `css` 目录中新一个后缀名为 `css` 的文件,然后可以在里面把站点的样式进行重定义,或是增加一些自己定义的样式设计,在写文章时进行引用,示例如下:

View File

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

View File

@ -6,6 +6,9 @@
{{ .Summary }} {{ .Summary }}
{{ end }} {{ end }}
{{ else }} {{ 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 }}
{{ end }} {{ end }}

View File

@ -5,7 +5,7 @@ description = "Easily & powerful theme for Hugo engine."
homepage = "https://github.com/hugo-next/hugo-theme-next" homepage = "https://github.com/hugo-next/hugo-theme-next"
tags = ["Blog", "Simple", "Personal", "Responsive", "Documentation", "Light", "Dark"] tags = ["Blog", "Simple", "Personal", "Responsive", "Documentation", "Light", "Dark"]
features = ["Blog", "Responsive", "Documentation", "Light", "Dark"] features = ["Blog", "Responsive", "Documentation", "Light", "Dark"]
min_version = "0.89.0" min_version = "0.134.0"
demosite = "https://preview.hugo-next.eu.org" demosite = "https://preview.hugo-next.eu.org"
[author] [author]