From 5b16dfd4bab03d1051197b237ecfb0acc753726c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 2 Sep 2025 21:55:33 +0200 Subject: [PATCH 1/3] Upgrade the Pagefind version to v1.4.0 This version most notably sports an optional Playground (see https://pagefind.app/docs/playground/) that _should_ help optimize the search parameters better. Release notes: https://github.com/Pagefind/pagefind/releases/tag/v1.4.0 Signed-off-by: Johannes Schindelin --- hugo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugo.yml b/hugo.yml index 845e25e84a..2c0008acf2 100644 --- a/hugo.yml +++ b/hugo.yml @@ -32,7 +32,7 @@ module: target: content params: hugo_version: 0.148.2 - pagefind_version: 1.3.0 + pagefind_version: 1.4.0 latest_version: 2.51.0 latest_relnote_url: https://raw.github.com/git/git/master/Documentation/RelNotes/2.51.0.adoc latest_release_date: '2025-08-18' From a9a8d4d0710bd0df0d742414f3cda8510caf32a2 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 4 Sep 2025 16:42:45 +0200 Subject: [PATCH 2/3] lychee: avoid problems between `--base-url` and relative paths When a HTML file in a subdirectory references a file in the same subdirectory via a relative path (e.g. Pagefind Playground's `` in `pagefind/playground/index.html`), lychee's `--base-url` option causes unwanted transformations: It pretends that that file is actually at the base URL. For example, running with `--base-url https://dscho.github.io/git-scm.com` will pretend that that CSS is at https://dscho.github.io/git-scm.com/pagefind-playground.css, skipping the `pagefind/playground/` altogether. This is a known issue, and lychee introduced a `--root-dir` option to accommodate. However, there remain problems, see e.g. https://github.com/lycheeverse/lychee/issues/1718. In our concrete case, we cannot easily use `--root-dir` because when we deploy to forks, the absolute paths have a `/git-scm.com/` prefix yet that is not the suffix of the absolute path of the `public/` folder! Even though it is not easily used, it _is_ possible: by constructing a separate path and adding a symbolic link whose name _is_ `git-scm.com` and which points to the `public/` directory. Then the parent directory of that symlink can be used as `--root-dir`. There is still one caveat: lychee ignores symbolic links when populating the initial set of files from a given base directory. So let's pass the path to that symlink, with trailing slash, as the base directory parameter. That seems to work. This change is needed because we are about to enable Pagefind's shiny new Playground, which has an `index.html` file in `/pagefind/playground/` that references a `.css` in the same directory via a relative link (which would be mishandled when using `--base-url`). Signed-off-by: Johannes Schindelin --- .../actions/deploy-to-github-pages/action.yml | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index 231894a6e5..2319cc9ad4 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -126,10 +126,33 @@ runs: -H "Content-Type: application/json" \ -d '{ "purge_everything": true }' - - name: construct `--remap` options for lychee + - name: construct `--remap` options, root-dir for lychee id: remap shell: bash run: | + # Prepare the root-dir for use with the `--root-dir` option + echo "root-dir-arg=$PWD/root-dir" >>$GITHUB_OUTPUT && + case "$base_url" in + https://*/?*|http://*/?*) + # The base URL is not at the top-level of the URL + subdir="${base_url#http*://*/}" + target="root-dir/${subdir%/}" + source="$(echo "${subdir%/}" | sed 's/[^/]*/../g')/public" + mkdir -p "${target%/*}" && + ln -s "$source" "$target" && + echo "root-dir=$target/" >>$GITHUB_OUTPUT + ;; + https://*|http://*) + # The base URL is at the top-level of the URL + ln -s public root-dir && + echo 'root-dir=root-dir/' >>$GITHUB_OUTPUT + ;; + *) + echo "::error::Unexpected base_url '$base_url'" >&2 + echo exit 1 + ;; + esac || exit + echo "result=$(echo "$base_url" | sed 's|^\(.*\)\(/git-scm\.com\)$|^(\1)?\2(.*)|') file://$PWD/public\$2" \ >>$GITHUB_OUTPUT @@ -163,7 +186,7 @@ runs: args: >- --offline --fallback-extensions html - --base '${{ env.base_url }}' + --root-dir '${{ steps.remap.outputs.root-dir-arg }}' --remap '${{ steps.remap.outputs.result }}' ${{ steps.remap.outputs.remap-dotdot }} ${{ steps.remap.outputs.remap-git-scm }} @@ -174,7 +197,7 @@ runs: --exclude file:///Pfad/zum/Repo.git/ --exclude file:///chemin/du/d%C3%A9p%C3%B4t.git/ --exclude file:///srv/git/project.git - public/ + '${{ steps.remap.outputs.root-dir }}' output: lychee.md jobSummary: true fail: false From a34823719491074049a410cd3ecb3a8bd078a469 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 2 Sep 2025 21:56:57 +0200 Subject: [PATCH 3/3] ci/deploy: do write the Pagefind Playground files This makes experimenting with Pagefind's search parameters easier, allowing to fiddle with the parameters in real-time by directing the browser to the `/pagefind/playground` URL. Signed-off-by: Johannes Schindelin --- .github/actions/deploy-to-github-pages/action.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index 2319cc9ad4..132d22f2f0 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -83,7 +83,7 @@ runs: - name: run Pagefind ${{ env.PAGEFIND_VERSION }} to build the search index shell: bash - run: npx -y pagefind@${{ env.PAGEFIND_VERSION }} --site public + run: npx -y pagefind@${{ env.PAGEFIND_VERSION }} --site public --write-playground - name: Temporarily copy some Rails assets to help the transition shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff035e2b6e..41804c1b0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: fi - name: run Pagefind ${{ env.PAGEFIND_VERSION }} to build the search index - run: npx -y pagefind@${{ env.PAGEFIND_VERSION }} --site public + run: npx -y pagefind@${{ env.PAGEFIND_VERSION }} --site public --write-playground - name: build tar archive run: cd public && tar czvf ../pages.tar.gz *