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

Hugo v0.141.0 support #1427

Merged
merged 6 commits into from
Jan 17, 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
2 changes: 1 addition & 1 deletion exampleSite/config/_default/privacy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Google Analytics 相关隐私 (被 params.analytics.google 替代)
[googleAnalytics]
# ...
[twitter]
[x]
enableDNT = true
[youtube]
privacyEnhanced = true
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ hiddenFromSearch: true

[relref]({{< relref "../../../about/index.en.md" >}})

## tweet
## x

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
{{< x user="SanDiegoZoo" id="1453110110599868418" >}}

## vimeo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ Please open the code block below to view the complete sample configuration {{< f
# {{< version 0.2.0 deleted >}} privacy of the Google Analytics (replaced by params.analytics.google)
[privacy.googleAnalytics]
# ...
[privacy.twitter]
[privacy.x]
enableDNT = true
[privacy.youtube]
privacyEnhanced = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ optimizeImages = true
# {{< version 0.2.0 deleted >}} Google Analytics 相关隐私 (被 params.analytics.google 替代)
[privacy.googleAnalytics]
# ...
[privacy.twitter]
[privacy.x]
enableDNT = true
[privacy.youtube]
privacyEnhanced = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ The rendered output looks like this:

[Documentation of `ref` and `relref`](https://gohugo.io/content-management/shortcodes#ref-and-relref)

## tweet
## x

[Documentation of `tweet`](https://gohugo.io/content-management/shortcodes#tweet)
[Documentation of `x`](https://gohugo.io/content-management/shortcodes#x)

Example `tweet` input:
Example `x` input:

```markdown
{{</* tweet user="SanDiegoZoo" id="1453110110599868418" */>}}
{{</* x user="SanDiegoZoo" id="1453110110599868418" */>}}
```

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
{{< x user="SanDiegoZoo" id="1453110110599868418" >}}

## vimeo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ Hugo 附带了一组预定义的 shortcodes, 它们实现了一些非常常见

[`ref` 和 `relref` 的文档](https://gohugo.io/content-management/shortcodes#ref-and-relref)

## tweet
## x

[`tweet` 的文档](https://gohugo.io/content-management/shortcodes#tweet)
[`x` 的文档](https://gohugo.io/content-management/shortcodes#x)

一个 `tweet` 示例:
一个 `x` 示例:

```markdown
{{</* tweet user="SanDiegoZoo" id="1453110110599868418" */>}}
{{</* x user="SanDiegoZoo" id="1453110110599868418" */>}}
```

{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
{{< x user="SanDiegoZoo" id="1453110110599868418" >}}

## vimeo

Expand Down
17 changes: 0 additions & 17 deletions layouts/partials/function/getImage.html

This file was deleted.

20 changes: 0 additions & 20 deletions layouts/partials/function/getRemoteImage.html

This file was deleted.

6 changes: 3 additions & 3 deletions layouts/partials/init.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- .Scratch.Set "version" "0.4.0" -}}

{{- /* Check Hugo version */ -}}
{{- $OLDEST_SUPPORTED_HUGO_VERSION := "0.134.0" -}}
{{- if lt hugo.Version $OLDEST_SUPPORTED_HUGO_VERSION -}}
{{- errorf "\n\nHugo version is too low.\nHugo 版本过低。\n\nCurrent Hugo version is %v, the oldest supported version is %v.\n目前使用的 Hugo 版本为 %v, DoIt 支持的最老的 Hugo 版本为 %v。\n\nIf you are running Hugo on your own computer, check out https://gohugo.io/getting-started/installing/#upgrade-hugo for upgrading guide.\n如果你正在自己的计算机上运行 Hugo,请访问 https://gohugo.io/getting-started/installing/#upgrade-hugo 以查阅升级指南。\n\nIf you are deploying on a third-party platform, please configure Hugo version accordingly.\n如果你正在第三方平台上部署,请按照相应文档配置 Hugo 版本。\n\n" hugo.Version $OLDEST_SUPPORTED_HUGO_VERSION hugo.Version $OLDEST_SUPPORTED_HUGO_VERSION -}}
{{- $MINIMAL_HUGO_VERSION := "0.141.0" -}}
{{- if lt hugo.Version $MINIMAL_HUGO_VERSION -}}
{{- errorf "\n\nHugo version is too low.\nHugo 版本过低。\n\nCurrent Hugo version is %v, the oldest supported version is %v.\n目前使用的 Hugo 版本为 %v, DoIt 支持的最老的 Hugo 版本为 %v。\n\nIf you are running Hugo on your own computer, check out https://gohugo.io/getting-started/installing/#upgrade-hugo for upgrading guide.\n如果你正在自己的计算机上运行 Hugo,请访问 https://gohugo.io/getting-started/installing/#upgrade-hugo 以查阅升级指南。\n\nIf you are deploying on a third-party platform, please configure Hugo version accordingly.\n如果你正在第三方平台上部署,请按照相应文档配置 Hugo 版本。\n\n" hugo.Version $MINIMAL_HUGO_VERSION hugo.Version $MINIMAL_HUGO_VERSION -}}
{{- end -}}

{{- /* Check Hugo extend */ -}}
Expand Down
12 changes: 7 additions & 5 deletions layouts/partials/plugin/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@
{{- $optimise := .Optimise | default site.Params.image.optimise | default false -}}

{{- if not $resource | and $isUrlRemote | and $cacheRemote -}}
{{- with $remoteResource := resources.GetRemote .Src -}}
{{- with try (resources.GetRemote .Src) -}}
{{- with .Err -}}
{{- warnf "%s" . -}}
{{ else }}
{{- if $remoteResource.ResourceType | eq "image" -}}
{{- $resource = $remoteResource -}}
{{- else with .Value -}}
{{- if .ResourceType | eq "image" -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- warnf "Unable to get resource %q" .Src -}}
{{- end -}}
{{- end -}}
{{- end -}}

Expand Down
Loading