{{ with .CurrentSection.OutputFormats.Get "rss" -}} - + {{ end -}} From 96baa453af2c62ef419ea952216d0cd970629874 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Fri, 19 Jan 2024 15:41:33 +0100 Subject: [PATCH 064/120] Fix warning: '.File.UniqueID on zero object' (#1007) (#1633) --- layouts/partials/section-index.html | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/layouts/partials/section-index.html b/layouts/partials/section-index.html index e1c83154c1..fc147f130b 100644 --- a/layouts/partials/section-index.html +++ b/layouts/partials/section-index.html @@ -1,31 +1,33 @@
- {{ $parent := .Page }} - {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }} + {{ $parent := .Page -}} + {{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}} {{ $pages = (where $pages "Type" "!=" "search") }} - {{ $pages = (where $pages ".Params.hide_summary" "!=" true) }} - {{ $pages = (where $pages ".Parent" "!=" nil) }} - {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }} - {{ if or $parent.Params.no_list (eq (len $pages) 0) }} + {{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}} + {{ $pages = (where $pages ".Parent" "!=" nil) -}} + {{ if .Parent.File -}} + {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}} + {{ end -}} + {{ if or $parent.Params.no_list (eq (len $pages) 0) -}} {{/* If no_list is true or we don't have subpages we don't show a list of subpages */}} - {{ else if $parent.Params.simple_list }} + {{ else if $parent.Params.simple_list -}} {{/* If simple_list is true we show a bulleted list of subpages */}}
    - {{ range $pages }} + {{ range $pages -}} {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
  • {{- .Title -}}
  • - {{ end }} + {{ end -}}
- {{ else }} + {{ else -}} {{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
- {{ range $pages }} - {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }} + {{ range $pages -}} + {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) -}}
{{- .Title -}}
-

{{ .Description | markdownify }}

+

{{ .Description | markdownify -}}

- {{ end }} - {{ end }} + {{ end -}} + {{ end -}}
From d98dced86119c97a1c14c87ea69023fdf232aef1 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 19 Jan 2024 09:50:03 -0500 Subject: [PATCH 065/120] [CI] Fix markdown-link-check ignore pattern & NPM link vers update (#1790) --- .markdown-link-check.json | 5 ++++- CHANGELOG.md | 2 +- .../docsy-as-module/installation-prerequisites.md | 2 +- userguide/content/en/docs/get-started/other-options.md | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.markdown-link-check.json b/.markdown-link-check.json index 05620c12cb..0cab66454b 100644 --- a/.markdown-link-check.json +++ b/.markdown-link-check.json @@ -4,7 +4,10 @@ "pattern": "^http://localhost" }, { - "pattern": "^https://badges.netlify.com/api/docsydocs.svg?branch=main" + "pattern": "^https://badges.netlify.com/api/docsydocs.svg\\?branch=main" + }, + { + "pattern": "https://docs.npmjs.com/cli/v10/using-npm/scripts#prepare-and-prepublish" } ], "timeout": "3s", diff --git a/CHANGELOG.md b/CHANGELOG.md index f00a2747ed..0196561edf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -307,7 +307,7 @@ Proceed as usual to build or serve your site. [hugo module]: https://www.docsy.dev/docs/get-started/docsy-as-module/ [other docsy setups]: https://www.docsy.dev/docs/get-started/other-options/ [prepare]: - https://docs.npmjs.com/cli/v8/using-npm/scripts#prepare-and-prepublish + https://docs.npmjs.com/cli/v10/using-npm/scripts#prepare-and-prepublish ## 0.3.0 diff --git a/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md b/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md index e3c69a5252..b4dfde7491 100644 --- a/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md +++ b/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md @@ -91,7 +91,7 @@ If no `git` client is installed on your system yet, go to the [Git website](http ## Install PostCSS -To build or update your site's CSS resources, you also need [`PostCSS`](https://postcss.org/) to create the final assets. If you need to install it, you must have a recent version of [NodeJS](https://nodejs.org/en/) installed on your machine so you can use `npm`, the Node package manager. By default `npm` installs tools under the directory where you run [`npm install`](https://docs.npmjs.com/cli/v6/commands/npm-install#description): +To build or update your site's CSS resources, you also need [`PostCSS`](https://postcss.org/) to create the final assets. If you need to install it, you must have a recent version of [NodeJS](https://nodejs.org/en/) installed on your machine so you can use `npm`, the Node package manager. By default `npm` installs tools under the directory where you run [`npm install`](https://docs.npmjs.com/cli/v10/commands/npm-install#description): ```bash npm install -D autoprefixer diff --git a/userguide/content/en/docs/get-started/other-options.md b/userguide/content/en/docs/get-started/other-options.md index 7a055f3bd4..1b899b15a6 100644 --- a/userguide/content/en/docs/get-started/other-options.md +++ b/userguide/content/en/docs/get-started/other-options.md @@ -351,6 +351,6 @@ from scratch as it provides defaults for many required configuration parameters. [lts release]: https://nodejs.org/en/about/releases/ [nvm]: https://github.com/nvm-sh/nvm/blob/master/README.md#installing-and-updating -[npm scripts]: https://docs.npmjs.com/cli/v8/using-npm/scripts +[npm scripts]: https://docs.npmjs.com/cli/v10/using-npm/scripts [prepare]: - https://docs.npmjs.com/cli/v8/using-npm/scripts#prepare-and-prepublish + https://docs.npmjs.com/cli/v10/using-npm/scripts#prepare-and-prepublish From fe4c06b1901f493505356b801fe465aa78c0e26a Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Sat, 20 Jan 2024 05:47:03 -0500 Subject: [PATCH 066/120] [CI] Smoke test new site from Hugo-module Docsy as well (#1795) --- .github/workflows/smoke.yaml | 7 +- tools/make-site.sh | 229 +++++++++++++++++++++++++---------- 2 files changed, 169 insertions(+), 67 deletions(-) diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index d1e291e326..c267bfda93 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -12,11 +12,12 @@ on: workflow_dispatch: jobs: - new-site-from-npm: + new-site: runs-on: ${{ matrix.os }} strategy: matrix: os: [windows-latest, ubuntu-latest] + docsy-src: [NPM, HUGO_MODULE] env: BASE_REPO: ${{ github.repository }} BRANCH: ${{ github.head_ref }} @@ -37,11 +38,11 @@ jobs: if: github.event_name != 'pull_request' run: | mkdir tmp && cd tmp && set -x - ../tools/make-site.sh -p $BASE_REPO -v $SHA + ../tools/make-site.sh -s ${{ matrix.docsy-src }} -r $BASE_REPO -v $SHA shell: bash - name: Make site from PR if: github.event_name == 'pull_request' run: | mkdir tmp && cd tmp && set -x - ../tools/make-site.sh -p $PR_REPO -v $BRANCH + ../tools/make-site.sh -s ${{ matrix.docsy-src }} -r $PR_REPO -v $BRANCH shell: bash diff --git a/tools/make-site.sh b/tools/make-site.sh index 30ac261282..413d24643a 100755 --- a/tools/make-site.sh +++ b/tools/make-site.sh @@ -3,29 +3,40 @@ set -eo pipefail DEPS="autoprefixer postcss-cli" +DOCSY_REPO_DEFAULT="google/docsy" +DOCSY_REPO=$DOCSY_REPO_DEFAULT +DOCSY_VERS="" +DOCSY_SRC="NPM" FORCE_DELETE=false : ${HUGO:=npx hugo} -NPM_PKG_VERS= -NPM_PKG="google/docsy" SITE_NAME="test-site" -THEMESDIR=node_modules +THEMESDIR="node_modules" +VERBOSE=1 +OUTPUT_REDIRECT="" # Use along with VERBOSE function _usage() { - echo - echo "Usage: `basename $0` [options]" - echo - echo " Creates a Docsy-themed site under SITE_NAME using the Hugo new command." - echo " Docsy is fetched as an NPM module from GitHub, unless the -l flag is used." - echo - echo " -f Force delete SITE_NAME if it exists before recreating it" - echo " -h Output this usage info" - echo " -l PATH Use Docsy at PATH rather than as an NPM package" - echo " -n SITE_NAME Name of directory to create for the Hugo generated site. Default: $SITE_NAME" - echo " -p NPM_PKG GitHub repo to fetch Docsy from as an NPM module" - echo " Format: GITHUB_USER/DOCSY_REPO. Default: $NPM_PKG" - echo " -v VERS Docsy NPM package version. Default: ''." - echo " Examples: semver:0.8.0, some-branch-name" - echo + cat <&2 + usage 1; + fi +} + +# Create site directory, checking if it exists first +function create_site_directory() { + if [ -e "$SITE_NAME" ]; then + if [ "$FORCE_DELETE" = true ]; then + echo "[INFO] Directory '$SITE_NAME' already exists. Deleting it as requested (-f)." + ([[ $VERBOSE ]] && set -x; rm -rf "$SITE_NAME") + else + echo "[ERROR] Directory '$SITE_NAME' already exists. Remove it or use -f to force delete." + exit 1 + fi + fi +} + +function _npm_install() { + npm init -y > /dev/null + npm install --omit dev --save $DEPS +} + +function set_up_and_cd_into_site() { + $HUGO new site --format yaml --quiet "$SITE_NAME" + cd "$SITE_NAME" + eval _npm_install $OUTPUT_REDIRECT + + if [[ "$DOCSY_SRC" == HUGO* ]]; then + _set_up_site_using_hugo_modules else - echo "[ERROR] Directory '$SITE_NAME' already exists. Remove it or use -f to force delete." - exit 1 + echo "theme: docsy" >> hugo.yaml + echo "themesDir: $THEMESDIR" >> hugo.yaml fi -fi +} -DOCSY_NPM_PKG=$NPM_PKG$NPM_PKG_VERS +function _set_up_site_using_hugo_modules() { + local user_name=$(whoami) + # : ${user_name:=$USER} + # : ${user_name:="me"} -set -x + HUGO_MOD_WITH_VERS=$DOCSY_REPO + if [[ -n $DOCSY_VERS ]]; then + HUGO_MOD_WITH_VERS+="@$DOCSY_VERS" + fi + + echo "[INFO] Getting Docsy as Hugo module $HUGO_MOD_WITH_VERS" -# Setup site -$HUGO new site --format yaml --quiet "$SITE_NAME" -cd "$SITE_NAME" -npm init -y > /dev/null -npm install --save-dev $DOCSY_NPM_PKG $DEPS + eval "$HUGO mod init github.com/$user_name/$SITE_NAME" $OUTPUT_REDIRECT + + if [[ "$DOCSY_REPO" == "$DOCSY_REPO_DEFAULT" ]]; then + eval "$HUGO mod get github.com/$HUGO_MOD_WITH_VERS" $OUTPUT_REDIRECT + else + echo "[INFO] Fetch Docsy GitHub repo '$DOCSY_REPO' @ '$DOCSY_VERS'" + mkdir tmp + BRANCH_SPEC="" + if [[ -n $DOCSY_VERS ]]; then + BRANCH_SPEC="-b $DOCSY_VERS" + fi + git clone --depth=1 https://github.com/$DOCSY_REPO $BRANCH_SPEC tmp/docsy + (cd tmp/docsy && git log -1) -echo "theme: docsy" >> hugo.yaml -echo "themesDir: $THEMESDIR" >> hugo.yaml + echo "replace github.com/$DOCSY_REPO_DEFAULT => ./tmp/docsy" >> go.mod + eval "$HUGO mod get github.com/$DOCSY_REPO_DEFAULT" $OUTPUT_REDIRECT + fi + + echo "module: {proxy: direct, hugoVersion: {extended: true}, imports: [{path: github.com/$DOCSY_REPO_DEFAULT, disable: false}]}" >> hugo.yaml +} -# Generate site -$HUGO +function main() { + process_CLI_args "$@" + create_site_directory -set +x + if [[ "$DOCSY_SRC" == "NPM" ]]; then + NPM_PKG=$DOCSY_REPO + if [[ -n $DOCSY_VERS ]]; then + NPM_PKG+="#$DOCSY_VERS" + fi + echo "[INFO] Getting Docsy as NPM package '$NPM_PKG'" + DEPS+=" $NPM_PKG" + elif [[ "$DOCSY_SRC" == "LOCAL" ]]; then + echo "[INFO] Getting Docsy through a local directory '$THEMESDIR" + fi + + [[ $VERBOSE ]] && set -x + set_up_and_cd_into_site + eval $HUGO $OUTPUT_REDIRECT # Generate site + [[ $VERBOSE ]] && set +x + cd .. + + echo "[INFO] '$SITE_NAME' successfully created, set up, and built." + + if [[ $VERBOSE ]]; then + echo "[INFO] Here are the site files:" + echo + set -x + ls -l "$SITE_NAME" + echo + ls -l "$SITE_NAME/public" + fi +} -echo "[INFO] $SITE_NAME successfully created, set up, and built." +main "$@" From d99b473933fd3fd65fc0fd7117309655b58454e3 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Sun, 21 Jan 2024 16:51:30 -0500 Subject: [PATCH 067/120] [CI] Disable scheduled runs of build and smoke tests (#1798) --- .github/workflows/smoke.yaml | 4 ++-- .github/workflows/test.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index c267bfda93..99659bb79c 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -7,8 +7,8 @@ on: push: branches: [main] pull_request: - schedule: # midnight every day - - cron: '0 0 * * *' + # schedule: # midnight every day + # - cron: '0 0 * * *' workflow_dispatch: jobs: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 74261610a1..589f1a51f9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,8 +7,8 @@ on: push: branches: [main] pull_request: - schedule: - - cron: '11 0 * * *' # 11 past midnight every day + # schedule: + # - cron: '11 0 * * *' # 11 past midnight every day workflow_dispatch: jobs: From d1f6ad618d493b850eb2e8abdb95ea53fd43f647 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Thu, 1 Feb 2024 12:37:13 +0100 Subject: [PATCH 068/120] Bump dependencies to their latest versions (#1802) --- netlify.toml | 2 +- package.json | 4 ++-- .../get-started/docsy-as-module/installation-prerequisites.md | 4 ++-- userguide/package.json | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/netlify.toml b/netlify.toml index cb0b5781e1..faebe858a0 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,7 +6,7 @@ publish = "userguide/public" command = "npm run docs-install && npm run build:preview" [build.environment] -GO_VERSION = "1.21.4" +GO_VERSION = "1.21.6" HUGO_THEME = "repo" [context.production] diff --git a/package.json b/package.json index f7750fd7e0..67eb26d463 100644 --- a/package.json +++ b/package.json @@ -40,10 +40,10 @@ "bootstrap": "5.2.3" }, "devDependencies": { - "hugo-extended": "0.120.4", + "hugo-extended": "0.122.0", "markdown-link-check": "^3.11.2", "mkdirp": "^3.0.1", - "prettier": "^3.0.3" + "prettier": "^3.2.4" }, "engines": { "node": ">=20" diff --git a/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md b/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md index b4dfde7491..1c0bc37cce 100644 --- a/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md +++ b/userguide/content/en/docs/get-started/docsy-as-module/installation-prerequisites.md @@ -70,7 +70,7 @@ Hugo's commands for module management require that the Go programming language i ```console $ go version -go version go1.21.4 +go version go1.21.6 ``` Ensure that you are using version 1.12 or higher. @@ -84,7 +84,7 @@ Hugo's commands for module management require that the `git` client is installed ```console $ git version -git version 2.42.1 +git version 2.43.0 ``` If no `git` client is installed on your system yet, go to the [Git website](https://git-scm.com/), download the installer for your system architecture and execute it. Afterwards, check for a successful installation. diff --git a/userguide/package.json b/userguide/package.json index 0925475578..a62ee87b5e 100644 --- a/userguide/package.json +++ b/userguide/package.json @@ -23,7 +23,7 @@ "update:pkg:dep": "npm install --save-dev autoprefixer@latest postcss-cli@latest" }, "devDependencies": { - "autoprefixer": "^10.4.16", - "postcss-cli": "^10.1.0" + "autoprefixer": "^10.4.17", + "postcss-cli": "^11.0.0" } } From 91efe359985017cfac3cc0cddf45dac79b3086ab Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Thu, 1 Feb 2024 12:43:02 +0100 Subject: [PATCH 069/120] Bump FontAwesome to latest released version 6.5.1 (#1803) --- go.mod | 2 +- go.sum | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index af10b9e8f5..2a51e364c6 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,6 @@ go 1.12 // AUTO-GENERATED using `npm run get:hugo-modules` require ( - github.com/FortAwesome/Font-Awesome v0.0.0-20230802202706-f0c25837a3fe // indirect + github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 // indirect github.com/twbs/bootstrap v5.2.3+incompatible // indirect ) diff --git a/go.sum b/go.sum index 0c285a9bf4..81a7cc5eb6 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ -github.com/FortAwesome/Font-Awesome v0.0.0-20230802202706-f0c25837a3fe h1:cwDWPzhCWsiI5IyPOvt+6L7enrMUzZ8zaRVjK6cUYg4= -github.com/FortAwesome/Font-Awesome v0.0.0-20230802202706-f0c25837a3fe/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= +github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 h1:LFS9LpoSZYhxQ6clU0NIVbaGR08BlxAs4b+9W+7IGVQ= +github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= github.com/twbs/bootstrap v5.2.3+incompatible h1:lOmsJx587qfF7/gE7Vv4FxEofegyJlEACeVV+Mt7cgc= github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/package.json b/package.json index 67eb26d463..8f5de1b1f6 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ }, "spelling": "cSpell:ignore docsy hugo fortawesome fontawesome userguide ", "dependencies": { - "@fortawesome/fontawesome-free": "6.4.2", + "@fortawesome/fontawesome-free": "6.5.1", "bootstrap": "5.2.3" }, "devDependencies": { From 58cdd3ae1f238059f6272a26b93d7281d41a6385 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Thu, 1 Feb 2024 14:29:51 +0100 Subject: [PATCH 070/120] Smoke test: improvements (#1800) --- .github/workflows/smoke.yaml | 4 ++-- tools/make-site.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index 99659bb79c..cb27552aa8 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -1,5 +1,5 @@ -# Smoke test across OSs: build a Docsy-based site from scratch, fetching Docsy -# via NPM. +# Smoke test across OSs: build a Docsy-based site from scratch, +# using Docsy as hugo module and fetching Docsy via NPM. name: smoke diff --git a/tools/make-site.sh b/tools/make-site.sh index 413d24643a..29c0415999 100755 --- a/tools/make-site.sh +++ b/tools/make-site.sh @@ -20,7 +20,7 @@ Usage: `basename $0` [options] Creates a Docsy-themed site under SITE_NAME using the Hugo new command. Docsy is fetched as an NPM package from $DOCSY_REPO in GitHub, - unless the -l or -d HUGO_MOD flags are used. + unless the -l or -s HUGO_MOD flags are used. -f Force delete SITE_NAME if it exists before recreating it -h Output this usage info @@ -71,7 +71,7 @@ function process_CLI_args() { s) DOCSY_SRC=$(echo "$OPTARG" | tr '[:lower:]' '[:upper:]') if [[ $DOCSY_SRC != "NPM" && $DOCSY_SRC != HUGO* ]]; then - echo "ERROR: invalid argument to -s flag: $DOCSY_SRC" + echo "ERROR: invalid argument to -s flag: $OPTARG" usage 1; fi ;; From 340cbf753f221d98ccbde338661f0c47dee86f30 Mon Sep 17 00:00:00 2001 From: LisaFC Date: Thu, 1 Feb 2024 14:26:38 +0000 Subject: [PATCH 071/120] Fix links for single language sites (#1744) --- layouts/partials/page-meta-links.html | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/layouts/partials/page-meta-links.html b/layouts/partials/page-meta-links.html index c8bacf4533..2b428bd584 100644 --- a/layouts/partials/page-meta-links.html +++ b/layouts/partials/page-meta-links.html @@ -1,5 +1,5 @@ {{ if .File }} -{{ $pathFormatted := replace .File.Path "\\" "/" -}} +{{ $pathFormatted := strings.TrimPrefix hugo.WorkingDir $.File.Filename -}} {{ $gh_repo := ($.Param "github_repo") -}} {{ $gh_url := ($.Param "github_url") -}} {{ $gh_subdir := ($.Param "github_subdir") -}} @@ -10,13 +10,9 @@ {{ warnf "Warning: use of `github_url` is deprecated. For details see https://www.docsy.dev/docs/adding-content/repository-links/#github_url-optional" -}} {{ T "post_edit_this" }} {{ else if $gh_repo -}} - {{ $gh_repo_path := printf "%s/content/%s" $gh_branch $pathFormatted -}} - {{ if and ($gh_subdir) (.Site.Language.Lang) -}} - {{ $gh_repo_path = printf "%s/%s/content/%s/%s" $gh_branch $gh_subdir ($.Site.Language.Lang) $pathFormatted -}} - {{ else if .Site.Language.Lang -}} - {{ $gh_repo_path = printf "%s/content/%s/%s" $gh_branch ($.Site.Language.Lang) $pathFormatted -}} - {{ else if $gh_subdir -}} - {{ $gh_repo_path = printf "%s/%s/content/%s" $gh_branch $gh_subdir $pathFormatted -}} + {{ $gh_repo_path := printf "%s%s" $gh_branch $pathFormatted -}} + {{ if $gh_subdir -}} + {{ $gh_repo_path = printf "%s/%s%s" $gh_branch $gh_subdir $pathFormatted -}} {{ end -}} {{/* Adjust $gh_repo_path based on path_base_for_github_subdir */ -}} @@ -35,7 +31,7 @@ {{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (safeURL $.Title ) -}} {{ $newPageStub := resources.Get "stubs/new-page-template.md" -}} {{ $newPageQS := querify "value" $newPageStub.Content "filename" "change-me.md" | safeURL -}} - {{ $newPageURL := printf "%s/new/%s?%s" $gh_repo (path.Dir $gh_repo_path) $newPageQS -}} + {{ $newPageURL := printf "%s/new/%s?%s" $gh_repo (path.Dir $gh_repo_path) $newPageQS -}} {{ T "post_view_this" }} {{ T "post_edit_this" }} From c1cad5f8b70e745de4acaa088eaaec36396a1eb7 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 1 Feb 2024 10:12:10 -0500 Subject: [PATCH 072/120] Whitespace cleanup in page-meta-links.html (#1808) --- layouts/partials/page-meta-links.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/page-meta-links.html b/layouts/partials/page-meta-links.html index 2b428bd584..165e5a9f02 100644 --- a/layouts/partials/page-meta-links.html +++ b/layouts/partials/page-meta-links.html @@ -1,4 +1,4 @@ -{{ if .File }} +{{ if .File -}} {{ $pathFormatted := strings.TrimPrefix hugo.WorkingDir $.File.Filename -}} {{ $gh_repo := ($.Param "github_repo") -}} {{ $gh_url := ($.Param "github_url") -}} From 435b2e0678694f3812a285a67dfac43f1c8ddd25 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 1 Feb 2024 16:35:51 -0500 Subject: [PATCH 073/120] Rework and clean up page-meta-links.html + CHANGELOG entry (#1807) --- .vscode/cspell.json | 2 +- CHANGELOG.md | 20 ++++++++++++++++++-- layouts/partials/page-meta-links.html | 26 +++++++++++++------------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index d3389d0e02..3e4a324385 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -2,5 +2,5 @@ { "version": "0.2", "caseSensitive": true, - "words": ["Docsy", "shortcode", "shortcodes"] + "words": ["Docsy", "hugo", "shortcode", "shortcodes", "warnf"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0196561edf..9e1a15358a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog @@ -25,13 +25,29 @@ For the full list of changes, see the [0.x.y] release notes. **Breaking changes**: -- ... +- [Repository Links] now work for [multi-language] sites ([#1744]). + + For any given page, repository links are now computed from a page's _resolved_ + `File` path, as resolved _through_ mount points, if any. That is, the path + used is the one that refers to the file's actual location on disk, not it's + logical path in Hugo's [union file system]. + + This is a breaking change pages of sites that use mounts and + [path_base_for_github_subdir]. Projects will need to adjust the value of + [path_base_for_github_subdir] to be relative to the file's physical location. **New**: **Other changes**: [0.x.y]: https://github.com/google/docsy/releases/latest?FIXME=v0.X.Y +[#1744]: https://github.com/google/docsy/pull/1744 +[multi-language]: https://www.docsy.dev/docs/language/ +[path_base_for_github_subdir]: + https://www.docsy.dev/docs/adding-content/repository-links/#path_base_for_github_subdir-optional +[Repository Links]: https://www.docsy.dev/docs/adding-content/repository-links/ +[union file system]: + https://gohugo.io/getting-started/directory-structure/#union-file-system ## 0.8.0 diff --git a/layouts/partials/page-meta-links.html b/layouts/partials/page-meta-links.html index 165e5a9f02..f34b6ebbbd 100644 --- a/layouts/partials/page-meta-links.html +++ b/layouts/partials/page-meta-links.html @@ -1,21 +1,18 @@ +{{/* cSpell:ignore querify subdir */ -}} {{ if .File -}} -{{ $pathFormatted := strings.TrimPrefix hugo.WorkingDir $.File.Filename -}} -{{ $gh_repo := ($.Param "github_repo") -}} -{{ $gh_url := ($.Param "github_url") -}} -{{ $gh_subdir := ($.Param "github_subdir") -}} -{{ $gh_project_repo := ($.Param "github_project_repo") -}} -{{ $gh_branch := (default "main" ($.Param "github_branch")) -}} +{{ $path := strings.TrimPrefix (add hugo.WorkingDir "/") $.File.Filename -}} +{{ $gh_repo := $.Param "github_repo" -}} +{{ $gh_url := $.Param "github_url" -}} +{{ $gh_subdir := $.Param "github_subdir" | default "" -}} +{{ $gh_project_repo := $.Param "github_project_repo" -}} +{{ $gh_branch := $.Param "github_branch" | default "main" -}}
{{ if $gh_url -}} - {{ warnf "Warning: use of `github_url` is deprecated. For details see https://www.docsy.dev/docs/adding-content/repository-links/#github_url-optional" -}} + {{ warnf "Warning: use of `github_url` is deprecated. For details, see https://www.docsy.dev/docs/adding-content/repository-links/#github_url-optional" -}} {{ T "post_edit_this" }} {{ else if $gh_repo -}} - {{ $gh_repo_path := printf "%s%s" $gh_branch $pathFormatted -}} - {{ if $gh_subdir -}} - {{ $gh_repo_path = printf "%s/%s%s" $gh_branch $gh_subdir $pathFormatted -}} - {{ end -}} - {{/* Adjust $gh_repo_path based on path_base_for_github_subdir */ -}} + {{/* Adjust $path based on path_base_for_github_subdir */ -}} {{ $ghs_base := $.Param "path_base_for_github_subdir" -}} {{ $ghs_rename := "" -}} {{ if reflect.IsMap $ghs_base -}} @@ -23,9 +20,12 @@ {{ $ghs_base = $ghs_base.from -}} {{ end -}} {{ with $ghs_base -}} - {{ $gh_repo_path = replaceRE . $ghs_rename $gh_repo_path -}} + {{ $path = replaceRE . $ghs_rename $path -}} {{ end -}} + {{ $gh_repo_path := printf "%s/%s/%s" $gh_branch $gh_subdir $path -}} + {{ $gh_repo_path = replaceRE "//+" "/" $gh_repo_path -}} + {{ $viewURL := printf "%s/tree/%s" $gh_repo $gh_repo_path -}} {{ $editURL := printf "%s/edit/%s" $gh_repo $gh_repo_path -}} {{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (safeURL $.Title ) -}} From 5d96fa33bf4b1dc4df0b8a34693ae4f6d2a9f283 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 2 Feb 2024 05:38:20 -0500 Subject: [PATCH 074/120] CHANGELOG copyedits & pin 0.9.0 as next release & NPM script tweaks (#1809) --- .github/workflows/test.yaml | 5 ++--- CHANGELOG.md | 24 ++++++++++++++---------- package.json | 7 ++++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 589f1a51f9..7d09b7e0cc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,5 +1,4 @@ -# Runs `npm test` to build Docsy & the User Guide and run all repo checks across -# OSs. +# Build Docsy & the User Guide and run all repo checks across OSs. name: test @@ -25,4 +24,4 @@ jobs: cache: npm cache-dependency-path: package.json - run: npm install --omit=optional - - run: npm test + - run: npm run test:all diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e1a15358a..eb2b40cd4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,28 +11,30 @@ notes][releases]. Useful links: - [Releases] & [tags]. Jump to the [latest] release. -- Milestones: [23Q4], [24Q1] +- [Milestones] -[23Q4]: https://github.com/google/docsy/milestone/9 [24Q1]: https://github.com/google/docsy/milestone/10 [latest]: https://github.com/google/docsy/releases/latest +[milestones]: https://github.com/google/docsy/milestones [releases]: https://github.com/google/docsy/releases [tags]: https://github.com/google/docsy/tags -## 0.8.1 or 0.9.0 - next planned release, WIP +## 0.9.0 -For the full list of changes, see the [0.x.y] release notes. +> ### UNRELEASED: this planned version is still under development. + +For the full list of changes, see the [0.9.0] release notes. **Breaking changes**: - [Repository Links] now work for [multi-language] sites ([#1744]). For any given page, repository links are now computed from a page's _resolved_ - `File` path, as resolved _through_ mount points, if any. That is, the path - used is the one that refers to the file's actual location on disk, not it's - logical path in Hugo's [union file system]. + `File` path — as resolved _through_ mount points, if any. That is, the + path used is the one that refers to the file's actual location on disk, not + it's logical path in Hugo's [union file system]. - This is a breaking change pages of sites that use mounts and + This is a breaking change for pages of sites that use mounts and [path_base_for_github_subdir]. Projects will need to adjust the value of [path_base_for_github_subdir] to be relative to the file's physical location. @@ -40,7 +42,7 @@ For the full list of changes, see the [0.x.y] release notes. **Other changes**: -[0.x.y]: https://github.com/google/docsy/releases/latest?FIXME=v0.X.Y +[0.9.0]: https://github.com/google/docsy/releases/latest?FIXME=v0.9.0 [#1744]: https://github.com/google/docsy/pull/1744 [multi-language]: https://www.docsy.dev/docs/language/ [path_base_for_github_subdir]: @@ -365,7 +367,9 @@ For the full list of changes, see the [0.2.0] release notes. Need{"Hugo version >= 0.93.0"} - Need -- No --> Off["Set params.mermaid.enable = true"] - Off --> Author - Need -- Yes --> Author[Insert mermaid codeblock] +sequenceDiagram + autonumber + Docsy user->>Discussion board: Ask question + Discussion board->>Community member: read question + loop Different strategies + Community member->>Test instance: Investigate issue raised + end + Note right of Community member: After hours of investigation: + Test instance-->>Community member: Come up with solution + Community member-->>Discussion board: Propose solution + Discussion board-->>Docsy user: check proposed solution + Docsy user->>Discussion board: Mark question as resolved + Docsy user->>Docsy user: Being happy ``` ```` -Automatically renders to: +which is automatically rendered to: ```mermaid -graph TD - Start --> Need{"Hugo version >= 0.93.0"} - Need -- No --> Off["Set params.mermaid.enable = true"] - Off --> Author - Need -- Yes --> Author[Insert mermaid codeblock] +sequenceDiagram + autonumber + Docsy user->>Discussion board: Ask question + Discussion board->>Community member: read question + loop Different strategies + Community member->>Test instance: Investigate issue raised + end + Note right of Community member: After hours of investigation: + Test instance-->>Community member: Come up with solution + Community member-->>Discussion board: Propose solution + Discussion board-->>Docsy user: check proposed solution + Docsy user->>Discussion board: Mark question as resolved + Docsy user->>Docsy user: Being happy ``` -With hugo version 0.93 or higher, support of Mermaid diagrams is automatically enabled as soon as you use a `mermaid` code block on your page. +Support of Mermaid diagrams is automatically enabled as soon as you use a `mermaid` code block on your page. -If you are using hugo version 0.92 or lower, you need to enable Mermaid manually by updating your `hugo.toml`/`hugo.yaml`/`hugo.json`: +By default, docsy pulls in the latest officially released version of Mermaid at build time. If that doesn't fit your needs, you can specify the wanted mermaid version inside your configuration file `hugo.toml`/`hugo.yaml`/`hugo.json`: {{< tabpane >}} -{{< tab header="Hugo version <= 0.92 only:" disabled=true />}} +{{< tab header="Configuration file:" disabled=true />}} {{< tab header="hugo.toml" lang="toml" >}} [params.mermaid] -enable = true +version = "10.8.0" {{< /tab >}} {{< tab header="hugo.yaml" lang="yaml" >}} params: mermaid: - enable: true + version: 10.8.0 {{< /tab >}} {{< tab header="hugo.json" lang="json" >}} { "params": { "mermaid": { - "enable": true + "version": "10.8.0" } } } @@ -424,7 +440,7 @@ params: See the [Mermaid documentation](https://mermaid-js.github.io/mermaid/#/Setup?id=mermaidapi-configuration-defaults) for a list of defaults that can be overridden. -Settings can also be overridden on a per-diagram basis by making use of the `%%init%%` header at the start of the diagram definition. See the [Mermaid theming documentation](https://mermaid-js.github.io/mermaid/#/theming?id=themes-at-the-local-or-current-level). +Settings can also be overridden on a per-diagram basis by making use of a [frontmatter config](http://mermaid.js.org/config/theming.html#customizing-themes-with-themevariables) block at the start of the diagram definition. ## UML Diagrams with PlantUML From 430921b4ddb784b1da970703909e0f60db57e952 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 2 Feb 2024 09:53:03 -0500 Subject: [PATCH 081/120] CHANGELOG updates for mermaid (#1816) --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c81f66a302..0907049350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,17 +40,21 @@ For the full list of changes, see the [0.9.0] release notes. - Docsy statically generates anchor-links after headings using Hugo's [render-heading.html](https://gohugo.io/templates/render-hooks/) hook. This is - potentially a breaking change for projects that override the hook. + _potentially_ a breaking change for projects that override the hook. **Other changes**: +- The latest release of [Mermaid] resources are fetch at build time ([#1410]) - Docsy follows recommended accessibility practice: page-body links are underlined. For details, see [#1814] and [#1815]. [0.9.0]: https://github.com/google/docsy/releases/latest?FIXME=v0.9.0 +[#1410]: https://github.com/google/docsy/pull/1410 [#1744]: https://github.com/google/docsy/pull/1744 [#1814]: https://github.com/google/docsy/issues/1814 [#1815]: https://github.com/google/docsy/pull/1815 +[mermaid]: + https://www.docsy.dev/docs/adding-content/diagrams-and-formulae/#diagrams-with-mermaid [multi-language]: https://www.docsy.dev/docs/language/ [path_base_for_github_subdir]: https://www.docsy.dev/docs/adding-content/repository-links/#path_base_for_github_subdir-optional From 93525047f7d4a5592bf2bd269d2f200b7baedc57 Mon Sep 17 00:00:00 2001 From: Yann Soubeyrand Date: Fri, 2 Feb 2024 16:03:44 +0100 Subject: [PATCH 082/120] layouts: split footer partial in several partials (#1500) --- layouts/partials/footer.html | 39 +++-------------------------- layouts/partials/footer/center.html | 11 ++++++++ layouts/partials/footer/left.html | 5 ++++ layouts/partials/footer/links.html | 9 +++++++ layouts/partials/footer/right.html | 5 ++++ 5 files changed, 34 insertions(+), 35 deletions(-) create mode 100644 layouts/partials/footer/center.html create mode 100644 layouts/partials/footer/left.html create mode 100644 layouts/partials/footer/links.html create mode 100644 layouts/partials/footer/right.html diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index b652549f2f..1bda7e9486 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,46 +1,15 @@ -{{ $links := .Site.Params.links -}}
-
- {{ with $links }} - {{ with index . "user" }} - {{ template "footer-links-block" . }} - {{ end }} - {{ end }} +
+ {{ partial "footer/left.html" . }}
- {{ with $links }} - {{ with index . "developer" }} - {{ template "footer-links-block" . }} - {{ end }} - {{ end }} + {{ partial "footer/right.html" . }}
- -{{- define "footer-links-block" }} - -{{ end -}} diff --git a/layouts/partials/footer/center.html b/layouts/partials/footer/center.html new file mode 100644 index 0000000000..0654746d7b --- /dev/null +++ b/layouts/partials/footer/center.html @@ -0,0 +1,11 @@ +{{ with .Site.Params.copyright -}} +© {{ now.Year }} {{ . }} {{ T "footer_all_rights_reserved" }} +{{- end }} +{{ with .Site.Params.privacy_policy -}} +{{ T "footer_privacy_policy" }} +{{- end }} +{{ if not .Site.Params.ui.footer_about_disable -}} +{{ with .Site.GetPage "about" -}} + +{{- end -}} +{{ end }} diff --git a/layouts/partials/footer/left.html b/layouts/partials/footer/left.html new file mode 100644 index 0000000000..2f093d4b21 --- /dev/null +++ b/layouts/partials/footer/left.html @@ -0,0 +1,5 @@ +{{ with .Site.Params.links }} +{{ with index . "user" }} +{{ partial "footer/links.html" . }} +{{ end }} +{{ end }} diff --git a/layouts/partials/footer/links.html b/layouts/partials/footer/links.html new file mode 100644 index 0000000000..0d84f4e1dd --- /dev/null +++ b/layouts/partials/footer/links.html @@ -0,0 +1,9 @@ + diff --git a/layouts/partials/footer/right.html b/layouts/partials/footer/right.html new file mode 100644 index 0000000000..57cf429573 --- /dev/null +++ b/layouts/partials/footer/right.html @@ -0,0 +1,5 @@ +{{ with .Site.Params.links }} +{{ with index . "developer" }} +{{ partial "footer/links.html" . }} +{{ end }} +{{ end }} From e22aec42bdff56ed2a7c6aa2a9f5e47a31ea0db8 Mon Sep 17 00:00:00 2001 From: Robert Fekete Date: Fri, 2 Feb 2024 18:48:10 +0100 Subject: [PATCH 083/120] Handle svg hero images in blocks/cover shortcode (#1505) --- layouts/shortcodes/blocks/cover.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/layouts/shortcodes/blocks/cover.html b/layouts/shortcodes/blocks/cover.html index a055c399f9..8779b3452b 100644 --- a/layouts/shortcodes/blocks/cover.html +++ b/layouts/shortcodes/blocks/cover.html @@ -9,8 +9,12 @@ {{ $height := .Get "height" | default "max" -}} {{ with $promo_image -}} -{{ $promo_image_big := (.Fill (printf "1920x1080 %s" $image_anchor)) -}} -{{ $promo_image_small := (.Fill (printf "960x540 %s" $image_anchor)) -}} +{{ $promo_image_big := . -}} +{{ $promo_image_small := . -}} +{{ if ne $promo_image.MediaType.SubType "svg" -}} + {{ $promo_image_big = .Fill (printf "1920x1080 %s" $image_anchor) -}} + {{ $promo_image_small = .Fill (printf "960x540 %s" $image_anchor) -}} +{{ end -}}