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

BREAKING CHANGE: fix Hugo's .Site.IsServer error #375

Merged
merged 1 commit into from
Aug 20, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
strategy:
matrix:
hugo:
- '0.48' # min version
- '0.54.0' # min version
- '0.58.2' # https://github.com/gohugoio/hugoThemes/issues/682
- '0.59.1' # last major version without goldmark renderer
- '0.60.1' # first major version with goldmark renderer
Expand All @@ -44,6 +44,7 @@ jobs:
- '0.86.1' # https://github.com/gohugoio/hugo/issues/9150
- '0.93.3' # https://github.com/gohugoio/hugo/commit/837fdfdf45014e3d5ef3b00b01548b68a4489c5f
- '0.123.8' # https://github.com/gohugoio/hugo/issues/12080
- '0.132.2' # .Site.IsServer deprecation ERROR
- 'latest'
fail-fast: true

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ to those feedback, otherwise the PR will be closed after 2-4 weeks of inactivity
### Pull Request Contribution Prerequisites

* You have Node & npm installed
* You have Hugo installed at v0.48.0+
* You have Hugo installed at v0.54.0+
* You are familiar with Git

### Pull Request Process
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/content/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ with the [Hugo](https://gohugo.io/) static site generator.
## Installation

Before installing the **Mainroad** theme, make sure that you've
[installed **Hugo** (version 0.48 or later)](https://gohugo.io/getting-started/quick-start/#step-1-install-hugo) and
[installed **Hugo** (version 0.54.0 or later)](https://gohugo.io/getting-started/quick-start/#step-1-install-hugo) and
[created a new site](https://gohugo.io/getting-started/quick-start/#step-2-create-a-new-site). To learn how to install
Hugo, visit [Hugo Documentation](https://gohugo.io/getting-started/installing/).

Expand Down
8 changes: 7 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@
{{- end }}

<link rel="shortcut icon" href="{{ "favicon.ico" | relURL }}">
{{- if not .Site.IsServer }}
{{- $server := "" }}
{{- if gt (int (index (split hugo.Version ".") 1)) "120" }}
{{ $server = hugo.IsServer }}
{{- else }}
{{ $server = .Site.IsServer }}
{{- end -}}
{{- if not $server }}
{{ template "_internal/google_analytics.html" . }}
{{- end }}
</head>
Expand Down
10 changes: 8 additions & 2 deletions layouts/partials/comments.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{{ if and .Site.Config.Services.Disqus.Shortname (index .Params "comments" | default "true") (not .Site.IsServer) }}
{{- $server := "" }}
{{- if ge (int (index (split hugo.Version ".") 1)) "120" }}
{{- $server = hugo.IsServer }}
{{- else }}
{{- $server = .Site.IsServer }}
{{- end }}
{{- if and .Site.Config.Services.Disqus.Shortname (index .Params "comments" | default "true") (not $server) }}
<section class="comments">
{{ template "_internal/disqus.html" . }}
</section>
{{ end }}
{{- end }}
2 changes: 1 addition & 1 deletion theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://github.com/vimux/mainroad/"
demosite = "https://mainroad-demo.netlify.app/"
tags = ["blog", "responsive", "light", "multilingual", "customizable", "widgets", "wordpress"]
features = ["blog", "responsive", "multilingual", "widgets", "rss", "disqus", "google analytics", "wordpress"]
min_version = "0.48"
min_version = "0.54.0"

[author]
name = "Vimux"
Expand Down
Loading