diff --git a/build/check-search-index.py b/build/check-search-index.py index a125a5c0..42ee84fb 100755 --- a/build/check-search-index.py +++ b/build/check-search-index.py @@ -28,14 +28,16 @@ def expected_pages(public): - """Return {URL: text}, skipping redirect stubs, the 404 page and HTML - fragments that aren't full pages.""" + """Return {URL: <title> text}, skipping redirect stubs, the 404 page, pages + marked data-search-unindexed (such as the search page) and HTML fragments that + aren't full pages.""" pages = {} for path in public.rglob("*.html"): source = path.read_text(encoding="utf-8", errors="replace") is_redirect = '<meta http-equiv="refresh"' in source is_fragment = "<html" not in source - if is_redirect or is_fragment or path.name == "404.html": + is_unindexed = "data-search-unindexed" in source + if is_redirect or is_fragment or is_unindexed or path.name == "404.html": continue url = "/" + path.relative_to(public).as_posix() title = re.search(r"<title>(.*?)", source, re.DOTALL) diff --git a/content/search.md b/content/search.md new file mode 100644 index 00000000..d573f60e --- /dev/null +++ b/content/search.md @@ -0,0 +1,4 @@ ++++ +title = "Search" +template = "search.html" ++++ diff --git a/sass/_valkey.scss b/sass/_valkey.scss index e050d92d..192fc233 100644 --- a/sass/_valkey.scss +++ b/sass/_valkey.scss @@ -2990,8 +2990,8 @@ blockquote { .calendar-nav .calendar-nav-title { font-size: 1.8rem; min-width: auto; } } -// Where a search result sits in the site -pagefind-modal .search-result-breadcrumb { +// Where a search result sits in the site, in the search modal and on the search page +pagefind-results .search-result-breadcrumb { margin: 0 0 4px; color: var(--pf-text-secondary); font-size: 13px; diff --git a/static/assets/js/search.js b/static/assets/js/search.js index 3c00b446..c52b1622 100644 --- a/static/assets/js/search.js +++ b/static/assets/js/search.js @@ -4,9 +4,28 @@ document.addEventListener('DOMContentLoaded', function() { // Without a search index, such as under zola serve, there is no search button. 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. - window.PagefindComponents.configureInstance('default', { + setUpInstance('default'); + + // Not compact, so the button has a visible "Search" label, not only an icon. Pagefind's default + // label is its lowercase "search" keyboard hint. + const trigger = document.createElement('pagefind-modal-trigger'); + trigger.setAttribute('placeholder', 'Search'); + keepScrollPositionOnClose(trigger); + slot.append(trigger); + // The modal goes on , inside the nav it would be hidden while the mobile menu is closed. + // The