diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index ccd5f1b..9de9763 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -43,8 +43,8 @@ jobs: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') runs-on: ubuntu-22.04 env: - HUGO_VERSION: v0.100.0 - GO_VERSION: '1.21' + HUGO_VERSION: 0.163.3 + GO_VERSION: '1.26' TZ: Europe/Oslo steps: - name: Checkout @@ -59,10 +59,11 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: false - - name: Install Hugo - run: | - # CGO is required for extended version - CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@${{ env.HUGO_VERSION }} + - name: Install Hugo (extended, prebuilt — matches local scoop binary) + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: ${{ env.HUGO_VERSION }} + extended: true - name: Verify Hugo installation run: | @@ -81,7 +82,7 @@ jobs: path: | blog/resources ${{ runner.temp }}/hugo_cache - key: hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}-${{ hashFiles('blog/config.*', 'blog/go.sum') }} + key: hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}-${{ hashFiles('blog/config/**', 'blog/go.sum') }} restore-keys: | hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}- @@ -101,7 +102,7 @@ jobs: path: | blog/resources ${{ runner.temp }}/hugo_cache - key: hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}-${{ hashFiles('blog/config.*', 'blog/go.sum') }} + key: hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}-${{ hashFiles('blog/config/**', 'blog/go.sum') }} - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/.gitignore b/.gitignore index 4b22a21..8cdee20 100644 --- a/.gitignore +++ b/.gitignore @@ -112,5 +112,7 @@ nginx/run/* .hugo_build.lock blog/public +# Generated Sass/asset cache — always rebuilt by Hugo/CI; committing it caused stale SRI hashes. +blog/resources/ .tmp/ \ No newline at end of file diff --git a/README.md b/README.md index ae07879..ad8d0c8 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,12 @@ In that case I need to simply run `hugo mod clean`, and then `hugo serve` again. ### Serve locally +Prerequisites: **Hugo Extended 0.163.3** and **Dart Sass** (kept in sync with CI). + ```sh +scoop install hugo-extended sass cd blog -go run github.com/gohugoio/hugo@v0.100.0 serve +make serve # or: hugo server ``` ### Process images diff --git a/blog/Makefile b/blog/Makefile index 950281f..4d861e7 100644 --- a/blog/Makefile +++ b/blog/Makefile @@ -1,6 +1,6 @@ .PHONY: serve -# Requires Hugo Extended (SCSS compilation). Install: scoop install hugo-extended -# Pinned in CI to v0.100.0; the local `hugo` should match to avoid theme API drift. +# Requires Hugo Extended + Dart Sass. Install: scoop install hugo-extended sass +# Pinned in CI to v0.163.3; the local `hugo` should match to avoid theme API drift. serve: hugo server diff --git a/blog/config/_default/config.toml b/blog/config/_default/config.toml index 7c61f4c..b11df2a 100644 --- a/blog/config/_default/config.toml +++ b/blog/config/_default/config.toml @@ -4,7 +4,6 @@ baseURL = 'https://itohi.com/' title = "ITOHI — Andrius Mikonis | Embedded Systems, AI & Defence Tech" copyright = "2022 @ ITOHI - All rights reserved" # canonifyurls = true -paginate = 13 theme = ["github.com/chipzoller/hugo-clarity"] disqusShortname = "www-itohi-com" @@ -15,6 +14,9 @@ DefaultContentLanguage = "en" # [menus] # config/_default/menus/menu.xx.toml +[pagination] +pagerSize = 13 + [taxonomies] category = "categories" tag = "tags" diff --git a/blog/config/_default/languages.toml b/blog/config/_default/languages.toml index e0d27f7..4fa8957 100644 --- a/blog/config/_default/languages.toml +++ b/blog/config/_default/languages.toml @@ -1,10 +1,10 @@ [en] title = "ITOHI — Andrius Mikonis | Embedded Systems, AI & Defence Tech" - LanguageName = "English" + label = "English" weight = 1 [lt] title = "ITOHI" - LanguageName = "Lietuviškai" + label = "Lietuviškai" weight = 2 diff --git a/blog/config/_default/markup.toml b/blog/config/_default/markup.toml index 031c9aa..56abd80 100644 --- a/blog/config/_default/markup.toml +++ b/blog/config/_default/markup.toml @@ -5,6 +5,11 @@ xhtml = false [goldmark.extensions] typographer = false + [goldmark.extensions.passthrough] + enable = true + [goldmark.extensions.passthrough.delimiters] + block = [['$$', '$$'], ['\[', '\]']] + inline = [['$', '$'], ['\(', '\)']] [goldmark.parser] [goldmark.parser.attribute] block = true diff --git a/blog/config/_default/params.toml b/blog/config/_default/params.toml index 224c75f..2b3d2c6 100644 --- a/blog/config/_default/params.toml +++ b/blog/config/_default/params.toml @@ -1,6 +1,11 @@ # enable search enableSearch = true +# Default content language, exposed to the theme's search JS so the English index +# is fetched from the site root (/index.json) instead of /en/index.json. +# Must match the top-level DefaultContentLanguage in config.toml. +defaultContentLanguage = "en" + # additional stylesheets loaded from the static directory (see static/css/) customCSS = ["css/custom.css"] diff --git a/blog/go.mod b/blog/go.mod index 180fcb5..714816d 100644 --- a/blog/go.mod +++ b/blog/go.mod @@ -2,4 +2,4 @@ module itohi-blog go 1.19 -require github.com/chipzoller/hugo-clarity v0.0.0-20221029154452-0dcfb1a9742c // indirect +require github.com/chipzoller/hugo-clarity v0.0.0-20260610142153-14929e3c0c03 // indirect diff --git a/blog/go.sum b/blog/go.sum index 9cd4bca..e9e1a1f 100644 --- a/blog/go.sum +++ b/blog/go.sum @@ -1,2 +1,4 @@ github.com/chipzoller/hugo-clarity v0.0.0-20221029154452-0dcfb1a9742c h1:RdfM7q3YWnTh4Bf4V/VHCLyLteepauj72lRG9FdWVAk= github.com/chipzoller/hugo-clarity v0.0.0-20221029154452-0dcfb1a9742c/go.mod h1:v1JkaKdcLRibyUCalLP2CNeFo6FGzfd4ipEr4dK0+Zg= +github.com/chipzoller/hugo-clarity v0.0.0-20260610142153-14929e3c0c03 h1:/25VfvPRZnEf3S3tMlt56HzkFgTnrDndqzA9mjb9A/0= +github.com/chipzoller/hugo-clarity v0.0.0-20260610142153-14929e3c0c03/go.mod h1:v1JkaKdcLRibyUCalLP2CNeFo6FGzfd4ipEr4dK0+Zg= diff --git a/blog/layouts/_default/_markup/render-codeblock-mermaid.html b/blog/layouts/_default/_markup/render-codeblock-mermaid.html index 47c15da..d6a1852 100644 --- a/blog/layouts/_default/_markup/render-codeblock-mermaid.html +++ b/blog/layouts/_default/_markup/render-codeblock-mermaid.html @@ -1,2 +1,2 @@ -
+
{{ .Inner }}
{{ .Page.Store.Set "hasMermaid" true }} \ No newline at end of file diff --git a/blog/themes/hugo-clarity-master/layouts/_default/rss.xml b/blog/layouts/_default/rss.xml similarity index 77% rename from blog/themes/hugo-clarity-master/layouts/_default/rss.xml rename to blog/layouts/_default/rss.xml index 02cb455..8c511b0 100644 --- a/blog/themes/hugo-clarity-master/layouts/_default/rss.xml +++ b/blog/layouts/_default/rss.xml @@ -1,3 +1,5 @@ +{{/* Local override of theme RSS template: .Site.LanguageCode -> .Site.Language.Locale + (LanguageCode deprecated in Hugo v0.158.0). Keep in sync with upstream otherwise. */}} {{- $pctx := . -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- $pages := slice -}} @@ -16,10 +18,10 @@ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} {{ .Permalink }} Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io{{ with .Site.LanguageCode }} - {{.}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + Hugo -- gohugo.io{{ with .Site.Language.Locale }} + {{.}}{{end}}{{ with .Site.Params.Author.email }} + {{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Params.Author.email }} + {{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} {{.}}{{end}}{{ if not .Date.IsZero }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} {{- with .OutputFormats.Get "RSS" -}} @@ -30,7 +32,7 @@ {{ .Title }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ with .Site.Params.Author.email }}{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}} {{ .Permalink }} {{ if ne site.Params.rss_summary false }} diff --git a/blog/layouts/partials/func/getStylesBundle.html b/blog/layouts/partials/func/getStylesBundle.html new file mode 100644 index 0000000..c1b46a9 --- /dev/null +++ b/blog/layouts/partials/func/getStylesBundle.html @@ -0,0 +1,10 @@ + +{{/* Local override: source maps disabled so the fingerprinted CSS stays deterministic and + its SRI hash matches the served file (a source-map comment appended post-fingerprint was + the cause of the dev-server "unstyled page" SRI mismatch). Transpiler is left at the + theme default (LibSass); switch to "dartsass" once upstream ships Dart-Sass-clean .sass. */}} +{{ $options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" false) }} +{{ $mainSassFile := "sass/main.sass" }} +{{ $styles := resources.Get $mainSassFile | resources.ExecuteAsTemplate $mainSassFile . | css.Sass $options | resources.Fingerprint "sha512" }} + +{{ return $styles }} diff --git a/blog/themes/hugo-clarity-master/layouts/partials/header.html b/blog/layouts/partials/header.html similarity index 81% rename from blog/themes/hugo-clarity-master/layouts/partials/header.html rename to blog/layouts/partials/header.html index a348b6e..04ad430 100644 --- a/blog/themes/hugo-clarity-master/layouts/partials/header.html +++ b/blog/layouts/partials/header.html @@ -1,3 +1,5 @@ +{{/* Local override of theme partial: .Language.LanguageName -> .Language.Label + (LanguageName deprecated in Hugo v0.158.0). Keep in sync with upstream otherwise. */}} {{- $params := .Site.Params }} {{- $centerLogo := $params.centerLogo }} {{ $logo := $params.logo }} @@ -10,19 +12,19 @@ {{- end }}