OSGeo / grass-website

Web site of GRASS GIS project (deployed from this repo twice a day)
https://grass.osgeo.org
GNU General Public License v3.0
17 stars 47 forks source link

Changes in Hugo configuration with newer Hugo version #394

Closed petrasovaa closed 4 months ago

petrasovaa commented 1 year ago

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 commented 1 year ago

See also #312

neteler commented 8 months ago

Same on my local (Fedora) machine.

However, on the Debian server we still have:

hugo 0.80.0-6+b5

neteler commented 8 months ago

According to @echoix in https://github.com/OSGeo/grass-website/issues/312#issuecomment-1687963262:

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 commented 7 months ago

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 commented 7 months ago

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:

echoix commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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

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

that @petrasovaa suggested in https://github.com/OSGeo/grass-website/issues/394#issue-1938733015 solved it, and it compiles without errors. So, that's how I use it locally to test changes.

neteler commented 4 months ago

I'm now updating hugo on grass.osgeo.org:

# https://gohugo.io/installation/linux/#build-from-source
VERSION="v0.113"
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@${VERSION}