diff --git a/content/authors/_index.md b/content/authors/_index.md index 98eed54c..0c716b89 100644 --- a/content/authors/_index.md +++ b/content/authors/_index.md @@ -3,4 +3,7 @@ title = "Authors" template = "authors.html" page_template = "author-page.html" sort_by = "title" + +[extra] +breadcrumb = "Blog › Authors" +++ \ No newline at end of file diff --git a/content/blog/_index.md b/content/blog/_index.md index b09c166b..6bb60305 100644 --- a/content/blog/_index.md +++ b/content/blog/_index.md @@ -4,4 +4,7 @@ description = "Stay up to date with the latest news, tutorials, and updates from sort_by = "date" template = "blog.html" page_template = "blog-page.html" + +[extra] +breadcrumb = "Blog" +++ \ No newline at end of file diff --git a/content/clients/_index.md b/content/clients/_index.md index 59dd2f25..f5d12c21 100644 --- a/content/clients/_index.md +++ b/content/clients/_index.md @@ -4,5 +4,6 @@ template = "libraries.html" render = true [extra] +breadcrumb = "Documentation › Clients" kind = "clients" +++ diff --git a/content/commands/_index.md b/content/commands/_index.md index 873b371d..0836dbeb 100644 --- a/content/commands/_index.md +++ b/content/commands/_index.md @@ -5,4 +5,7 @@ page_template = "command-page.html" aliases= [ "/docs/topics/commands/" ] + +[extra] +breadcrumb = "Commands" +++ \ No newline at end of file diff --git a/content/community/_index.md b/content/community/_index.md index 107f465e..9d9d2f11 100644 --- a/content/community/_index.md +++ b/content/community/_index.md @@ -4,6 +4,7 @@ description = "Join the Valkey community: contribute code, docs, and content, sp template = "community-home.html" page_template = "community.html" [extra] +breadcrumb = "Community" hero = { title = "Built by the community. For the community.", subtitle = "Every contributor started somewhere: a bug report, a talk, a line of code. This community is built one key at a time. Yours starts here.", image = "/img/community/hero-community.jpg" } connect = { title = "Connect with us", description = "Ask questions, share ideas, and meet the Valkey community.", links = [ diff --git a/content/docs/index.md b/content/docs/index.md index 2086a7b7..cf141ad4 100644 --- a/content/docs/index.md +++ b/content/docs/index.md @@ -3,6 +3,7 @@ title = "Documentation" template = "block-menu.html" page_template = "docs-page.html" [extra] +breadcrumb = "Documentation" body_class= "blocks-page" +++ diff --git a/content/download/index.md b/content/download/index.md index e3bebd7c..58699a27 100644 --- a/content/download/index.md +++ b/content/download/index.md @@ -1,6 +1,9 @@ +++ template = "download.html" title = "Download" + +[extra] +breadcrumb = "Download" +++ For installation instructions, supported package managers, and how to configure Valkey, see the diff --git a/content/download/releases/_index.md b/content/download/releases/_index.md index fa7457a1..3e387473 100644 --- a/content/download/releases/_index.md +++ b/content/download/releases/_index.md @@ -3,4 +3,7 @@ title = "Releases" page_template= "release-page.html" template= "release-section.html" sort_by= "title" + +[extra] +breadcrumb = "Download" +++ \ No newline at end of file diff --git a/content/download/versions/_index.md b/content/download/versions/_index.md index fc23cbbc..db131653 100644 --- a/content/download/versions/_index.md +++ b/content/download/versions/_index.md @@ -4,4 +4,7 @@ render = false page_template = "release-line.html" sort_by = "title" + +[extra] +breadcrumb = "Download" +++ diff --git a/content/events/_index.md b/content/events/_index.md index 4781a7c7..6be88410 100644 --- a/content/events/_index.md +++ b/content/events/_index.md @@ -4,4 +4,7 @@ template = "events.html" page_template = "event-page.html" sort_by = "date" generate_feeds = true + +[extra] +breadcrumb = "Community" +++ diff --git a/content/integrations/_index.md b/content/integrations/_index.md index fa722e51..bb86263c 100644 --- a/content/integrations/_index.md +++ b/content/integrations/_index.md @@ -4,5 +4,6 @@ template = "libraries.html" render = true [extra] +breadcrumb = "Documentation › Integrations" kind = "integrations" +++ diff --git a/content/participants.md b/content/participants.md index 3fa050db..19b25494 100644 --- a/content/participants.md +++ b/content/participants.md @@ -1,6 +1,8 @@ --- template: participants.html title: Participate with Valkey +extra: + breadcrumb: Participants --- # Valkey Participants diff --git a/content/topics/_index.md b/content/topics/_index.md index c759c280..3bb8f304 100644 --- a/content/topics/_index.md +++ b/content/topics/_index.md @@ -3,4 +3,7 @@ title = "Topics" template = "docs.html" page_template = "docs-page.html" aliases = ["/docs/topics/"] + +[extra] +breadcrumb = "Topics" +++ diff --git a/static/assets/js/search.js b/static/assets/js/search.js index e88cc2f5..22950aa9 100644 --- a/static/assets/js/search.js +++ b/static/assets/js/search.js @@ -1,7 +1,8 @@ document.addEventListener('DOMContentLoaded', function() { const slot = document.getElementById('site-search'); + const modalContents = document.getElementById('search-modal-contents'); // Without a search index, such as under zola serve, there is no search button. - if (!window.PagefindComponents || !slot) return; + if (!window.PagefindComponents || !slot || !modalContents) return; // Configure before creating the elements: the first element to connect creates the // instance with default settings, and configuration after that is ignored. @@ -16,9 +17,11 @@ document.addEventListener('DOMContentLoaded', function() { const trigger = document.createElement('pagefind-modal-trigger'); trigger.setAttribute('compact', ''); + keepScrollPositionOnClose(trigger); slot.append(trigger); // The modal goes on
, inside the nav it would be hidden while the mobile menu is closed. - document.body.append(createModal()); + // The it's built from is never shown, so it can be anywhere. + document.body.append(createModal(modalContents)); }); // Each page's breadcrumb is a filter rather than metadata, since Pagefind searches metadata and @@ -74,45 +77,33 @@ function putExactTitleMatchesFirst(instance) { }; } -// Pagefind's default modal contents, written out so the results can use RESULT_TEMPLATE. -function createModal() { +// When the modal closes, Pagefind focuses the search button, which scrolls it into view. The header +// isn't sticky, so closing search from further down a page jumped back to the top. This makes that +// focus not scroll, as the browser does when it returns focus from a closed dialog. +// +// The Component UI has no option for this, so this wraps the button's private close handler, +// handleModalClose in pagefind-modal-trigger.ts, and changes only the focus it does. +function keepScrollPositionOnClose(trigger) { + const handleModalClose = trigger.handleModalClose; + if (typeof handleModalClose !== 'function') return; + trigger.handleModalClose = function() { + const button = this.buttonEl; + if (!button) return handleModalClose.call(this); + button.focus = function(options) { + HTMLElement.prototype.focus.call(this, { ...options, preventScroll: true }); + }; + try { + return handleModalClose.call(this); + } finally { + delete button.focus; + } + }; +} + +// The modal's contents are in templates/includes/search-modal.html, in a so the Pagefind +// elements stay inactive until the modal has moved them into its dialog. +function createModal(contents) { const modal = document.createElement('pagefind-modal'); - // Parse the contents in an inert so the Pagefind elements stay un-upgraded until the - // modal has moved them into its dialog; otherwise each one initializes twice. - const template = document.createElement('template'); - template.innerHTML = ` -