From 0fbf7d0d99af87d3c35aeb7834cf8154ad164c26 Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Sun, 2 Jun 2024 15:54:00 +1000 Subject: [PATCH] Make pagefind work in docker (#3899) * Make search results appear in a fixed window; Make search text clickable; Improve search layout on mobile. * On window resize, adjust layout * Maybe make Firefox not resize. * Tweak initial- and maximum-scale * Make live-html work with pagefind; Make pagefind work in docker * Lint * Fix netlify deploy --- .gitignore | 2 ++ Dockerfile | 16 ++++++++++++++++ Makefile | 28 +++++++++++++++++----------- pagefind.yml | 1 + 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 45f3e8ae8d..ec3104e01f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ venv .vscode *.DS_Store /.idea/ + +_pagefind/ diff --git a/Dockerfile b/Dockerfile index a99ffa478b..12bf5362d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ software-properties-common \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* +ENV PAGEFIND_VERSION="1.1.0" +ARG TARGETARCH +SHELL ["/bin/bash", "-c"] +RUN < _static/webserver-v1.min.js @@ -43,7 +43,9 @@ api: net-html: sphinx-build -M html . _build -j auto -n $(O) + mkdir -p _pagefind/pagefind ${NET_PAGEFIND} + sphinx-build -M html . _build -j auto -n $(O) -Dhtml_extra_path=_redirects,_pagefind netlify-api: netlify-dependencies mkdir -p _build/html/api @@ -60,9 +62,9 @@ netlify-dependencies: pagefind-binary pagefind-binary: mkdir -p ../pagefindbin - curl -o pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz https://github.com/CloudCannon/pagefind/releases/download/v$(PAGEFIND_VERSION)/pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz -L - tar xzf pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz - rm pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz + curl -o pagefind.tar.gz https://github.com/CloudCannon/pagefind/releases/download/v$(PAGEFIND_VERSION)/pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz -L + tar xzf pagefind.tar.gz + rm pagefind.tar.gz mv pagefind ${NET_PAGEFIND} @@ -74,6 +76,10 @@ netlify: netlify-dependencies netlify-api net-html copy-svg2png lint: html-strict python3 lint.py +clean: + rm -rf _pagefind/ + sphinx-build -M clean . _build $(O) + # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile diff --git a/pagefind.yml b/pagefind.yml index c034230ce8..07f44b1bee 100644 --- a/pagefind.yml +++ b/pagefind.yml @@ -1,4 +1,5 @@ site: _build/html +output_path: _pagefind/pagefind exclude_selectors: - "a.headerlink" - ".toctree-wrapper"