Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: all build errors and supports the latest version of Hugo #890

Merged
merged 11 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ version: 2.1
jobs:
build-check:
docker:
- image: cibuilds/hugo:0.62
- image: cibuilds/hugo:0.128.0
working_directory: ~/LoveIt
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init
- run: hugo --source=exampleSite -v --gc
- run: htmlproofer exampleSite/public --check-html --allow-hash-href --empty-alt-ignore --disable-external
- run: htmlproofer exampleSite/public --disable-external true --ignore-missing-alt true

workflows:
build-check-exampleSite:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LoveIt Theme | Hugo [![Netlify Status](https://api.netlify.com/api/v1/badges/e60303f2-862c-4342-bf59-7c9adb10812e/deploy-status)](https://app.netlify.com/sites/hugo-loveit/deploys)

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/releases)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.62.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.128.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dillonzq_LoveIt&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=dillonzq_LoveIt)
[![CircleCI](https://circleci.com/gh/dillonzq/LoveIt/tree/master.svg?style=svg)](https://circleci.com/gh/dillonzq/LoveIt/tree/master)
Expand Down
4 changes: 2 additions & 2 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LoveIt 主题 | Hugo [![Netlify Status](https://api.netlify.com/api/v1/badges/e60303f2-862c-4342-bf59-7c9adb10812e/deploy-status)](https://app.netlify.com/sites/hugo-loveit/deploys)

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/releases)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.62.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.128.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dillonzq_LoveIt&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=dillonzq_LoveIt)
[![CircleCI](https://circleci.com/gh/dillonzq/LoveIt/tree/master.svg?style=svg)](https://circleci.com/gh/dillonzq/LoveIt/tree/master)
Expand Down Expand Up @@ -62,7 +62,7 @@
* 支持 **[Fathom Analytics](https://usefathom.com/)**
* 支持 **[Plausible Analytics](https://plausible.io/)**
* 支持 **[Yandex Metrica](https://metrica.yandex.com/)**
* 支持搜索引擎的**网站验证** (Google, Bind, Yandex and Baidu)
* 支持搜索引擎的**网站验证** (Google, Bind, Yandex Baidu)
* 支持所有第三方库的 **CDN**
* 基于 [lazysizes](https://github.com/aFarkas/lazysizes) 自动转换图片为**懒加载**

Expand Down
Binary file added assets/lib/lightgallery/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[module]
[module.hugoVersion]
extended = true
min = "0.62.0"
min = "0.128.0"

[params]
# site default theme ["auto", "light", "dark"]
Expand All @@ -28,6 +28,13 @@
# 网站图片, 用于 Open Graph 和 Twitter Cards
images = []

# Author config
# 作者配置
[params.author]
name = "xxxx"
email = ""
link = ""

# Header config
# 页面头部导航栏配置
[params.header]
Expand Down
24 changes: 14 additions & 10 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ languageName = "English"
# 是否包括中日韩文字
hasCJKLanguage = false

# default amount of posts in each pages
# 默认每页列表显示的文章数目
paginate = 12
# google analytics code [UA-XXXXXXXX-X]
# 谷歌分析代号 [UA-XXXXXXXX-X]
googleAnalytics = ""
Expand All @@ -48,12 +45,12 @@ enableEmoji = true
# 忽略一些构建错误
ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]

# Author config
# 作者配置
[author]
name = "xxxx"
email = ""
link = ""
# Pagination config
# 分页配置
[pagination]
disableAliases = false
pagerSize = 10
path = "page"

# Menu config
# 菜单配置
Expand Down Expand Up @@ -114,6 +111,13 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
# 网站图片, 用于 Open Graph 和 Twitter Cards
images = ["/logo.png"]

# Author config
# 作者配置
[params.author]
name = "xxxx"
email = ""
link = ""

# Header config
# 页面头部导航栏配置
[params.header]
Expand Down Expand Up @@ -747,7 +751,7 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]

# Permalinks config (https://gohugo.io/content-management/urls/#permalinks)
# Permalinks 配置 (https://gohugo.io/content-management/urls/#permalinks)
[Permalinks]
[permalinks]
# posts = ":year/:month/:filename"
posts = ":filename"

Expand Down
2 changes: 1 addition & 1 deletion exampleSite/content/about/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ math:

{{< style "img { height: 1.25rem; }" >}}
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/releases)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.62.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.128.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/dillonzq/LoveIt?style=social)](https://github.com/dillonzq/LoveIt)
[![GitHub forks](https://img.shields.io/github/forks/dillonzq/LoveIt?style=social)](https://github.com/dillonzq/LoveIt/fork)
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/about/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ math:

{{< style "img { height: 1.25rem; }" >}}
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/releases)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.62.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.128.0-ff4088?style=flat-square&logo=hugo)](https://gohugo.io/)
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/dillonzq/LoveIt?style=social)](https://github.com/dillonzq/LoveIt)
[![GitHub forks](https://img.shields.io/github/forks/dillonzq/LoveIt?style=social)](https://github.com/dillonzq/LoveIt/fork)
Expand All @@ -35,7 +35,7 @@ math:
* :(far fa-chart-bar fa-fw): 支持 **[Fathom Analytics](https://usefathom.com/)**
* :(fas fa-chart-column fa-fw): 支持 **[Plausible Analytics](https://plausible.io/)**
* :(fab fa-yandex-international fa-fw): 支持 **[Yandex Metrica](https://metrica.yandex.com/)**
* :(fas fa-sitemap fa-fw): 支持搜索引擎的**网站验证** (Google, Bind, Yandex and Baidu)
* :(fas fa-sitemap fa-fw): 支持搜索引擎的**网站验证** (Google, Bind, Yandex Baidu)
* :(fas fa-tachometer-alt fa-fw): 支持所有第三方库的 **CDN**
* :(fas fa-cloud-download-alt fa-fw): 基于 [lazysizes](https://github.com/aFarkas/lazysizes) 自动转换图片为**懒加载**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This article offers a sample of basic Markdown syntax that can be used in Hugo c
<!--more-->

{{< admonition >}}
This article is a shameful copy of the great [Grav original page](http://learn.getgrav.org/content/markdown).
This article is a shameful copy of the great [Grav original page](https://learn.getgrav.org/content/markdown).

If you want to know about the extended Markdown syntax of **LoveIt** theme, please read [extended Markdown syntax page](../theme-documentation-content#extended-markdown-syntax).
{{< /admonition >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ lightgallery: true
<!--more-->

{{< admonition >}}
这篇文章借鉴了一篇很棒的[来自 Grav 的文章](http://learn.getgrav.org/content/markdown).
这篇文章借鉴了一篇很棒的[来自 Grav 的文章](https://learn.getgrav.org/content/markdown).

如果你想了解 **Loveit** 主题的扩展 Markdown 语法, 请阅读[扩展 Markdown 语法页面](../theme-documentation-content#extended-markdown-syntax).
{{< /admonition >}}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 16 additions & 19 deletions exampleSite/content/posts/theme-documentation-basics/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ Discover what the Hugo - **LoveIt** theme is all about and the core-concepts beh

Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme.

Just install latest version of [:(far fa-file-archive fa-fw): Hugo (> 0.62.0)](https://gohugo.io/getting-started/installing/) for your OS (**Windows**, **Linux**, **macOS**).
Just install latest **extended edition** of [:(far fa-file-archive fa-fw): Hugo (> 0.128.0)](https://gohugo.io/getting-started/installing/) for your OS (**Windows**, **Linux**, **macOS**).

{{< admonition note "Why not support earlier versions of Hugo?" >}}
Since [Markdown Render Hooks](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks) was introduced in the [Hugo Christmas Edition](https://gohugo.io/news/0.62.0-relnotes/), this theme only supports Hugo versions above **0.62.0**.
{{< /admonition >}}
{{< admonition note "Why need to use Hugo **extended edition**" >}}
Since some features of this theme need to processes :(fab fa-sass fa-fw): SCSS to :(fab fa-css3 fa-fw): CSS, you need to use Hugo **extended edition** for correct rendering.

{{< admonition tip "Hugo extended version is recommended" >}}
Since some features of this theme need to processes :(fab fa-sass fa-fw): SCSS to :(fab fa-css3 fa-fw): CSS, it is recommended to use Hugo **extended** version for better experience.
![Hugo extended edition](hugo-extended-edition.png "Hugo extended edition")
{{< /admonition >}}

## 2 Installation
Expand Down Expand Up @@ -89,12 +87,6 @@ languageCode = "en"
# language name ["English", "简体中文", "Français", "Polski", ...]
languageName = "English"

# Author config
[author]
name = "xxxx"
email = ""
link = ""

# Menu config
[menu]
[[menu.main]]
Expand Down Expand Up @@ -174,6 +166,7 @@ it is highly recommended that you add `--disableFastRender` parameter to `hugo s
```bash
hugo serve --disableFastRender
```

{{< /admonition >}}

### 2.6 Build the Website
Expand Down Expand Up @@ -215,8 +208,6 @@ languageName = "English"
# whether to include Chinese/Japanese/Korean
hasCJKLanguage = false

# default amount of posts in each pages
paginate = 12
# google analytics code [UA-XXXXXXXX-X]
googleAnalytics = ""
# copyright description used only for seo schema
Expand All @@ -232,11 +223,11 @@ enableEmoji = true
# ignore some build errors
ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]

# Author config
[author]
name = "xxxx"
email = ""
link = ""
# Pagination config
[pagination]
disableAliases = false
pagerSize = 10
path = "page"

# Menu config
[menu]
Expand Down Expand Up @@ -285,6 +276,12 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
# website images for Open Graph and Twitter Cards
images = ["/logo.png"]

# Author config
[params.author]
name = "xxxx"
email = ""
link = ""

# Header config
[params.header]
# desktop header mode ["fixed", "normal", "auto"]
Expand Down
37 changes: 17 additions & 20 deletions exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ toc:

## 1 准备

由于 Hugo 提供的便利性, [Hugo](https://gohugo.io/) 本身是这个主题唯一的依赖.
由于 Hugo 提供的便利性, [Hugo](https://gohugo.io/) 是这个主题唯一的依赖.

直接安装满足你操作系统 (**Windows**, **Linux**, **macOS**) 的最新版本 [:(far fa-file-archive fa-fw): Hugo (> 0.62.0)](https://gohugo.io/getting-started/installing/).
直接安装满足你操作系统 (**Windows**, **Linux**, **macOS**) 的最新 **extended** 版本 [:(far fa-file-archive fa-fw): Hugo (> 0.128.0)](https://gohugo.io/getting-started/installing/).

{{< admonition note "为什么不支持早期版本的 Hugo?" >}}
由于 [Markdown 渲染钩子函数](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks) 在 [Hugo 圣诞节版本](https://gohugo.io/news/0.62.0-relnotes/) 中被引入, 本主题只支持高于 **0.62.0** 的 Hugo 版本.
{{< /admonition >}}
{{< admonition note "为什么需要使用 Hugo extended 版本" >}}
由于这个主题的一些特性需要将 :(fab fa-sass fa-fw): SCSS 转换为 :(fab fa-css3 fa-fw): CSS, 你需要使用 Hugo **extended** 版本来获得正确的渲染效果.

{{< admonition tip "推荐使用 Hugo extended 版本" >}}
由于这个主题的一些特性需要将 :(fab fa-sass fa-fw): SCSS 转换为 :(fab fa-css3 fa-fw): CSS, 推荐使用 Hugo **extended** 版本来获得更好的使用体验.
![Hugo extended 版本](hugo-extended-edition.png "Hugo extended 版本")
{{< /admonition >}}

## 2 安装
Expand Down Expand Up @@ -91,12 +89,6 @@ languageName = "简体中文"
# 是否包括中日韩文字
hasCJKLanguage = true

# 作者配置
[author]
name = "xxxx"
email = ""
link = ""

# 菜单配置
[menu]
[[menu.main]]
Expand Down Expand Up @@ -176,6 +168,7 @@ hugo serve
```bash
hugo serve --disableFastRender
```

{{< /admonition >}}

### 2.6 构建网站
Expand Down Expand Up @@ -217,8 +210,6 @@ languageName = "简体中文"
# 是否包括中日韩文字
hasCJKLanguage = true

# 默认每页列表显示的文章数目
paginate = 12
# 谷歌分析代号 [UA-XXXXXXXX-X]
googleAnalytics = ""
# 版权描述,仅仅用于 SEO
Expand All @@ -234,11 +225,11 @@ enableEmoji = true
# 忽略一些构建错误
ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]

# 作者配置
[author]
name = "xxxx"
email = ""
link = ""
# 分页配置
[pagination]
disableAliases = false
pagerSize = 10
path = "page"

# 菜单配置
[menu]
Expand Down Expand Up @@ -287,6 +278,12 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
# 网站图片, 用于 Open Graph 和 Twitter Cards
images = ["/logo.png"]

# 作者配置
[params.author]
name = "xxxx"
email = ""
link = ""

# 页面头部导航栏配置
[params.header]
# 桌面端导航栏模式 ["fixed", "normal", "auto"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ The rendered output looks like this:
Example `tweet` input:

```markdown
{{</* tweet 917359331535966209 */>}}
{{</* tweet user=GoHugoIO id=917359331535966209 */>}}
```

The rendered output looks like this:

{{< tweet 917359331535966209 >}}
{{< tweet user=GoHugoIO id=917359331535966209 >}}

## 8 vimeo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ For more information please have a look at GitHub issue [#7879](https://github.c
一个 `tweet` 示例:

```markdown
{{</* tweet 917359331535966209 */>}}
{{</* tweet user=GoHugoIO id=917359331535966209 */>}}
```

呈现的输出效果如下:

{{< tweet 917359331535966209 >}}
{{< tweet user=GoHugoIO id=917359331535966209 >}}

## 8 vimeo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ Raw content using Markdown syntax: {{< raw >}}**Hello**{{< /raw >}}

## 13 person

`person` is a shortcode to insert a link to a personal webpage marked up as [h-card](http://microformats.org/wiki/h-card).
`person` is a shortcode to insert a link to a personal webpage marked up as [h-card](https://microformats.org/wiki/h-card).

The `person` shortcode has the following named parameters:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ console.log('Hello LoveIt!');

## 13 person

`person` shortcode 用来在你的文章中以 [h-card](http://microformats.org/wiki/h-card) 的格式插入个人网站链接.
`person` shortcode 用来在你的文章中以 [h-card](https://microformats.org/wiki/h-card) 的格式插入个人网站链接.

`person` shortcode 有以下命名参数:

Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ <h1 class="single-title" itemprop="name headline">

{{- /* Meta */ -}}
<div class="post-meta">
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
{{- $author := $params.author | default .Site.Params.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Params.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/a.html" $options -}}
Expand Down
6 changes: 3 additions & 3 deletions layouts/index.rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
{{- with .Site.Params.Author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
Expand Down
Loading