diff --git a/Dockerfile b/Dockerfile index 7a5e0dfe7897..f3f69b4f1af3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ARG HTMLTEST_VERSION=0.17.0 ARG VALE_VERSION=3.11.2 ARG HUGO_VERSION=0.154.2 ARG NODE_VERSION=22 -ARG PAGEFIND_VERSION=1.3.0 +ARG PAGEFIND_VERSION=1.5.0-beta.1 # base defines the generic base stage FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base diff --git a/assets/css/pagefind.css b/assets/css/pagefind.css new file mode 100644 index 000000000000..a6619c3b104a --- /dev/null +++ b/assets/css/pagefind.css @@ -0,0 +1,25 @@ +/* Pagefind Component UI Customizations */ + +/* Dark mode variables for modal */ +.dark pagefind-modal { + --pf-text: var(--color-gray-100); + --pf-text-secondary: var(--color-gray-300); + --pf-text-muted: var(--color-gray-400); + --pf-background: var(--color-gray-900); + --pf-border: var(--color-gray-700); + --pf-border-focus: var(--color-blue-400); + --pf-hover: var(--color-gray-800); +} + +/* Highlight marks in results */ +pagefind-results mark { + background-color: var(--color-yellow-200); + color: inherit; + padding: 0 0.125rem; + border-radius: 0.125rem; +} + +.dark pagefind-results mark { + background-color: rgba(255, 204, 72, 0.3); + color: white; +} diff --git a/assets/css/style.css b/assets/css/style.css index 8315621f425d..f63fc6f5aec2 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -38,6 +38,7 @@ @import "global.css"; } @import "utilities.css"; +@import "pagefind.css"; @import "syntax-dark.css"; @import "syntax-light.css"; @import "components.css"; diff --git a/content/_index.md b/content/_index.md index 7de643bad9a0..b49f900340d2 100644 --- a/content/_index.md +++ b/content/_index.md @@ -2,4 +2,6 @@ title: Home description: Docker Documentation is the official Docker library of resources, manuals, and guides to help you containerize applications. keywords: Docker, documentation, manual, guide, reference, api, samples +aliases: + - /search/ --- diff --git a/content/search.md b/content/search.md deleted file mode 100644 index 59f5903bbb33..000000000000 --- a/content/search.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Search -layout: search -params: - sitemap: false - icon: search ---- diff --git a/docs_engineer.yml b/docs_engineer.yml index 736148e3cd0d..b383057029d8 100644 --- a/docs_engineer.yml +++ b/docs_engineer.yml @@ -290,6 +290,7 @@ agents: toolsets: - type: filesystem + - type: fetch - type: shell - type: todo - type: script diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 946147a21e9c..ebb1e7f5d850 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -63,6 +63,7 @@ {{ if ne .Params.sitemap false }}data-pagefind-body{{- end }} class="dark:bg-background-dark w-full min-w-0 bg-white p-8" > + {{ partial "pagefind-meta.html" . }} {{ block "main" . }} {{ end }} diff --git a/layouts/_default/search.html b/layouts/_default/search.html deleted file mode 100644 index 3192eaadaa4b..000000000000 --- a/layouts/_default/search.html +++ /dev/null @@ -1,191 +0,0 @@ -{{ define "left" }}{{ partial "sidebar/mainnav.html" . }}{{ end }} {{ define -"main" }} -
-

{{ .Title }}

- {{ .Content }} -
-
- -
-

- Not finding what you're looking for? Try -

- -
-
-
-
- -
-
-
- -{{ end }} diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html index fc893af263e2..7c2ce060db9d 100644 --- a/layouts/partials/breadcrumbs.html +++ b/layouts/partials/breadcrumbs.html @@ -1,19 +1,13 @@ diff --git a/layouts/partials/head.html b/layouts/partials/head.html index dfc8f368d690..ea19cfcd958d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -5,6 +5,7 @@ {{ end -}} {{ partial "utils/css.html" "-" }} + {{- if hugo.IsProduction -}} - + // Show/hide placeholder based on search state + const instance = getInstanceManager().getInstance('default'); + instance.on('search', (term) => { + placeholder.hidden = !!term; + }); + instance.on('results', () => { + placeholder.hidden = !!instance.searchTerm; + }); + + // Open modal + const openModal = () => modal.open?.(); + document.getElementById('search-modal-trigger').addEventListener('click', openModal); + document.addEventListener('keydown', (e) => { + if ((e.metaKey || e.ctrlKey) && e.key === 'k') { + e.preventDefault(); + openModal(); + } + }); + diff --git a/netlify.toml b/netlify.toml index cb07b6343c93..a55b635e2901 100644 --- a/netlify.toml +++ b/netlify.toml @@ -10,4 +10,4 @@ HUGO_ENVIRONMENT = "preview" SECRETS_SCAN_OMIT_PATHS = "public/contribute/file-conventions/index.html" [context.deploy-preview] -command = "hugo --gc --minify -b $DEPLOY_PRIME_URL && ./hack/flatten-and-resolve.js && npx pagefind@v1.3.0" +command = "hugo --gc --minify -b $DEPLOY_PRIME_URL && ./hack/flatten-and-resolve.js && npx pagefind@v1.5.0-beta.1"