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

Changes in Hugo configuration with newer Hugo version #394

Open
petrasovaa opened this issue Oct 11, 2023 · 8 comments
Open

Changes in Hugo configuration with newer Hugo version #394

petrasovaa opened this issue Oct 11, 2023 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@petrasovaa
Copy link
Contributor

I have now Hugo 0.110.0 and I had to do these changes to run hugo and display images:

diff --git a/config.toml b/config.toml
index d46b91e..125cabb 100644
--- a/config.toml
+++ b/config.toml
@@ -26,8 +26,10 @@ greyColorDark = "#A0A0A0"
 
 
 [markup]
-  defaultMarkdownHandler = "blackfriday"
+  defaultMarkdownHandler = "goldmark"
 
+[markup.goldmark.renderer]
+  unsafe = true
 
@neteler
Copy link
Member

neteler commented Oct 11, 2023

See also #312

@neteler
Copy link
Member

neteler commented Mar 7, 2024

Same on my local (Fedora) machine.

However, on the Debian server we still have:

hugo 0.80.0-6+b5

@neteler
Copy link
Member

neteler commented Mar 7, 2024

According to @echoix in #312 (comment):

The default and Commonmark-Compliant renderer is Goldmark since v0.61 (gohugoio/hugo#5963 in 2019).

we may simply switch to "goldmark" which would also be supported in Debian's oldish hugo 0.80.0-6+b5?

@veroandreo
Copy link
Contributor

I've been checking old hugo tags and goldmark updates appear as far as v0.65... so, it should be fine with v0.80, I guess. In any case, is it possible to update hugo in the server?

@neteler
Copy link
Member

neteler commented Mar 10, 2024

In any case, is it possible to update hugo in the server?

We are on Debian "bullseye" which offers hugo 0.80.0-6+b5.

According to https://packages.debian.org/search?keywords=hugo:

  • seems that "bullseye-backports" offers hugo 0.104.3-1~bpo11+1
  • not sure which mess we may get activating "bullseye-backports" on the server?

@echoix
Copy link
Member

echoix commented Mar 10, 2024

Hugo is a go binary, which are fully statically compiled (and single file). You could download the binary from a release, or if go is available on the system, go install ... and in 10 seconds you'd have it available (or even go run ... since go compilation is that fast and easy, you can just run from source).

The issue of having the old version on the server could be avoided like that.

The more appropriate solution, that we don't seem ready yet, would be to do like what a hosting should be like, to compile on one side, and then deploy the site (content) afterwards to the hosting server.

@neteler neteler added the help wanted Extra attention is needed label Mar 11, 2024
@neteler
Copy link
Member

neteler commented Mar 11, 2024

For a test, I have compiled and installed go and then a fresh hugo version:

neteler@grasslxd:~$ hugo version
hugo v0.123.8+extended linux/amd64 BuildDate=unknown

Locally on the server I have changed the renderer to "goldmark", but it won't build the site:

nice sh /home/neteler/cronjobs/hugo_clean_and_update_job.sh 
From https://github.com/OSGeo/grass-website
 * branch            master     -> FETCH_HEAD
Already up to date.
WARN  deprecated: config: languages.en.license: custom params on the language top level was deprecated in Hugo v0.112.0 and will be removed in a future release. Put the value below [languages.en.params]. See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120
WARN  deprecated: config: languages.en.dateformat: custom params on the language top level was deprecated in Hugo v0.112.0 and will be removed in a future release. Put the value below [languages.en.params]. See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120
WARN  deprecated: config: languages.en.socialicon: custom params on the language top level was deprecated in Hugo v0.112.0 and will be removed in a future release. Put the value below [languages.en.params]. See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120
WARN  deprecated: config: languages.en.logo: custom params on the language top level was deprecated in Hugo v0.112.0 and will be removed in a future release. Put the value below [languages.en.params]. See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120
Start building sites … 
hugo v0.123.8+extended linux/amd64 BuildDate=unknown

ERROR render of "page" failed: "/home/neteler/grass-website/themes/grass/layouts/news/news.html:26:10": execute of template failed: template: news/news.html:26:10: executing "news/news.html" at <.Content>: error calling Content: "/home/neteler/grass-website/content/news/2023_12_19_annual_report.md:1:1": execute of template failed: template: _default/_markup/render-link.html:1:14: executing "_default/_markup/render-link.html" at <urls.Parse>: error calling Parse: parse "(https://cnr.ncsu.edu/geospatial/news/2023/04/26/spring-2023-geospatial-forum-rewind/)": first path segment in URL cannot contain colon
Total in 7975 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/home/neteler/grass-website/themes/grass/layouts/download/os.html:26:5": execute of template failed: template: download/os.html:26:5: executing "download/os.html" at <.Content>: error calling Content: "/home/neteler/grass-website/content/download/windows.en.md:30:4": failed to render shortcode "donateDialog": "/home/neteler/grass-website/content/download/windows.en.md:1:1": failed to render shortcode "currentVersion.inline": no earlier definition of shortcode "currentVersion.inline" found

This requires a PR (volunteers?).

For now I have re-installed hugo 0.80 to keep the site running.

@veroandreo
Copy link
Contributor

veroandreo commented Mar 11, 2024

I get the same error in my local tests, but the

+[markup.goldmark.renderer]
+  unsafe = true

that @petrasovaa suggested in #394 (comment) solved it, and it compiles without errors. So, that's how I use it locally to test changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants