Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f0b4be72c | ||
|
|
7a09b136bb | ||
|
|
ffab83a637 | ||
|
|
9add062300 | ||
|
|
12daa8c9fc | ||
|
|
f804db2c80 | ||
|
|
090378e4da |
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# @file
|
||||
# Builds a Hugo site hosted on a Cloudflare Worker.
|
||||
#
|
||||
# The Cloudflare Worker automatically installs Node.js dependencies.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
main() {
|
||||
DART_SASS_VERSION=1.97.1
|
||||
GO_VERSION=1.25.5
|
||||
HUGO_VERSION=0.154.5
|
||||
NODE_VERSION=24.12.0
|
||||
|
||||
export TZ=Europe/Oslo
|
||||
|
||||
# Install Dart Sass
|
||||
echo "Installing Dart Sass ${DART_SASS_VERSION}..."
|
||||
curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
export PATH="${HOME}/.local/dart-sass:${PATH}"
|
||||
|
||||
# Install Go
|
||||
echo "Installing Go ${GO_VERSION}..."
|
||||
curl -sLJO "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
tar -C "${HOME}/.local" -xf "go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
rm "go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
export PATH="${HOME}/.local/go/bin:${PATH}"
|
||||
|
||||
# Install Hugo
|
||||
echo "Installing Hugo ${HUGO_VERSION}..."
|
||||
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
mkdir "${HOME}/.local/hugo"
|
||||
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
export PATH="${HOME}/.local/hugo:${PATH}"
|
||||
|
||||
# Install Node.js
|
||||
echo "Installing Node.js ${NODE_VERSION}..."
|
||||
curl -sLJO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
tar -C "${HOME}/.local" -xf "node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
rm "node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
export PATH="${HOME}/.local/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"
|
||||
|
||||
# Verify installations
|
||||
echo "Verifying installations..."
|
||||
echo Dart Sass: "$(sass --version)"
|
||||
echo Go: "$(go version)"
|
||||
echo Hugo: "$(hugo version)"
|
||||
echo Node.js: "$(node --version)"
|
||||
|
||||
# Configure Git
|
||||
echo "Configuring Git..."
|
||||
git config core.quotepath false
|
||||
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
|
||||
git fetch --unshallow
|
||||
fi
|
||||
|
||||
# Build the site
|
||||
echo "Building the site..."
|
||||
cd demo
|
||||
hugo --gc --minify --themesDir=/opt/buildhome --theme=repo
|
||||
}
|
||||
|
||||
set -euo pipefail
|
||||
main "$@"
|
||||
@@ -33,15 +33,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@for $i from 1 through length($defaultTagBackgrounds) {
|
||||
&:nth-child(#{length($defaultTagBackgrounds)}n + #{$i}) {
|
||||
.article-category a {
|
||||
background: nth($defaultTagBackgrounds, $i);
|
||||
color: nth($defaultTagColors, $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
$defaultTagBackgrounds: #8ea885, #df7988, #0177b8, #ffb900, #6b69d6;
|
||||
$defaultTagColors: #fff, #fff, #fff, #fff, #fff;
|
||||
|
||||
/*
|
||||
* Global style
|
||||
*/
|
||||
|
||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1 @@
|
||||
hugo server --gc --themesDir=../..
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
{{- $subsections := .Sections -}}
|
||||
{{- $pages := .Pages | complement $subsections -}}
|
||||
{{- $pages = where $pages "Params.hidden" "!=" true -}}
|
||||
|
||||
{{- if eq (len $pages) 0 -}}
|
||||
{{/* If there are no normal pages, display subsections in list style, with pagination */}}
|
||||
@@ -68,12 +69,14 @@
|
||||
{{- end -}}
|
||||
|
||||
{{/* List only pages that are not a subsection */}}
|
||||
{{ $paginator := .Paginate $pages }}
|
||||
<section class="article-list--compact">
|
||||
{{ range $paginator.Pages }}
|
||||
{{ partial "article-list/compact" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ $paginator := partial "helper/paginator.html" . }}
|
||||
{{ with $paginator }}
|
||||
<section class="article-list--compact">
|
||||
{{ range .Pages }}
|
||||
{{ partial "article-list/compact" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{- partial "pagination.html" . -}}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
{{ partialCached "footer/footer" . }}
|
||||
|
||||
{{ partialCached "article/components/photoswipe" . }}
|
||||
{{ partialCached "article/components/mermaid" . }}
|
||||
{{ partial "article/components/mermaid" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "right-sidebar" }}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
{{ define "main" }}
|
||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||
{{ $filtered := where $pages "Params.hidden" "!=" true }}
|
||||
{{ $pag := .Paginate ($filtered) }}
|
||||
{{- $paginator := partial "helper/paginator.html" . -}}
|
||||
|
||||
<section class="article-list">
|
||||
{{ range $index, $element := $pag.Pages }}
|
||||
{{ range $index, $element := $paginator.Pages }}
|
||||
{{ partial "article-list/default" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
{{ if .Params.categories }}
|
||||
<header class="article-category">
|
||||
{{ range (.GetTerms "categories") }}
|
||||
<a href="{{ .RelPermalink }}" {{ with .Params.style }}style="background-color: {{ .background }}; color: {{ .color }};"{{ end }}>
|
||||
{{ $color := partial "helper/color-from-str" .LinkTitle }}
|
||||
{{ $BackgroundColor := default $color.BackgroundColor .Params.style.background }}
|
||||
{{ $TextColor := default $color.TextColor .Params.style.color }}
|
||||
<a href="{{ .RelPermalink }}" style="background-color: {{ $BackgroundColor | safeCSS }}; color: {{ $TextColor | safeCSS }};">
|
||||
{{ .LinkTitle }}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,37 +1,14 @@
|
||||
{{- $title := .Title -}}
|
||||
{{- $pageTitle := .Title -}}
|
||||
{{- $siteTitle := .Site.Title -}}
|
||||
{{- $paginator := partial "helper/paginator.html" . -}}
|
||||
|
||||
{{- if .IsHome -}}
|
||||
<!-- Homepage, and it's pagination -->
|
||||
{{- $title := slice -}}
|
||||
|
||||
<!-- Build paginator -->
|
||||
{{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
|
||||
{{ $filtered := where $pages "Params.hidden" "!=" true }}
|
||||
{{ $pag := .Paginate ($filtered) }}
|
||||
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<!-- Paginated. Append page number to title -->
|
||||
{{ $title = printf "%s - %s" .Paginator $siteTitle }}
|
||||
{{ else }}
|
||||
{{ $title = $siteTitle}}
|
||||
{{ end }}
|
||||
{{- else if eq .Kind "term" -}}
|
||||
<!-- Taxonomy page -->
|
||||
|
||||
<!-- Build paginator -->
|
||||
{{ $notHidden := where .Pages "Params.hidden" "!=" true }}
|
||||
{{ $pag := .Paginate ($notHidden) }}
|
||||
|
||||
<!-- {TAXONOMY_TYPE}: {TAXONOMY_TERM} -->
|
||||
{{ $title = slice (title .Data.Singular) ": " $title }}
|
||||
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<!-- Add page number-->
|
||||
{{ $title = $title | append " - " .Paginator }}
|
||||
{{ end }}
|
||||
|
||||
{{ $title = $title | append " - " $siteTitle }}
|
||||
{{ $title = delimit $title "" }}
|
||||
{{- if and $paginator $paginator.HasPrev -}}
|
||||
<!-- Add page number-->
|
||||
{{ $title = $title | append (printf "Page %d" $paginator.PageNumber) }}
|
||||
{{- end -}}
|
||||
|
||||
{{ return $title }}
|
||||
{{- $title = $title | append (default $siteTitle $pageTitle) -}}
|
||||
|
||||
{{ return delimit $title " - " }}
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $ThemeVersion := "3.33.0" -}}
|
||||
{{- $ThemeVersion := "3.34.1" -}}
|
||||
<footer class="site-footer">
|
||||
<section class="copyright">
|
||||
©
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{{/*
|
||||
This helper is used to generate a background color and text color from a string
|
||||
Used to generate deterministic colors for tags, categories, etc.
|
||||
*/}}
|
||||
|
||||
{{- $str := . -}}
|
||||
{{- $hash := hash.FNV32a $str -}}
|
||||
{{- $h := mod $hash 360 -}}
|
||||
|
||||
{{- $backgroundColor := printf "hsl(%d, 60%%, 84%%)" $h -}}
|
||||
{{- $textColor := printf "hsl(%d, 60%%, 15%%)" $h -}}
|
||||
|
||||
{{- return dict "BackgroundColor" $backgroundColor "TextColor" $textColor "Hue" $h -}}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- $pages := "" -}}
|
||||
|
||||
{{- if .IsHome -}}
|
||||
{{ $pages = where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
|
||||
{{ $pages = where $pages "Params.hidden" "!=" true }}
|
||||
{{- else if eq .Kind "term" -}}
|
||||
{{ $pages = where .Pages "Params.hidden" "!=" true }}
|
||||
{{- else if or (eq .Kind "section") (eq .Kind "taxonomy") -}}
|
||||
{{ $subsections := .Sections }}
|
||||
{{ $pages = .Pages | complement $subsections }}
|
||||
{{ $pages = where $pages "Params.hidden" "!=" true }}
|
||||
|
||||
{{- if eq (len $pages) 0 -}}
|
||||
{{/* See complete logic in list.html */}}
|
||||
{{- $pages = $subsections -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $pages -}}
|
||||
{{ $pages = .Paginate $pages }}
|
||||
{{- end -}}
|
||||
|
||||
{{ return $pages }}
|
||||
@@ -1,26 +0,0 @@
|
||||
[build]
|
||||
publish = "exampleSite/public"
|
||||
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.152.2"
|
||||
HUGO_THEME = "repo"
|
||||
|
||||
[context.production]
|
||||
command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${URL}"
|
||||
[context.production.environment]
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${DEPLOY_PRIME_URL}"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${DEPLOY_PRIME_URL}"
|
||||
|
||||
[[plugins]]
|
||||
package = "netlify-plugin-hugo-cache-resources"
|
||||
|
||||
[plugins.inputs]
|
||||
# If it should show more verbose logs (optional, default = true)
|
||||
debug = true
|
||||
# Relative path to source directory in case you use Hugo's "--s" option
|
||||
srcdir = "exampleSite"
|
||||
@@ -0,0 +1,9 @@
|
||||
name = "hugo-theme-stack"
|
||||
compatibility_date = "2026-01-25"
|
||||
|
||||
[build]
|
||||
command = "chmod a+x ./.ci/build.sh && ./.ci/build.sh"
|
||||
|
||||
[assets]
|
||||
directory = "demo/public"
|
||||
not_found_handling = "404-page"
|
||||