From 102da43f76aa7d2df5e52c32dcd4a84fa32a7297 Mon Sep 17 00:00:00 2001 From: Jakub Zych Date: Fri, 30 Oct 2026 18:14:05 +0100 Subject: [PATCH] feat: opt-in Journal search page and JournalSearchBox - journal.routes.search (off by default) registers journal-search, the results page for ?q= in the API's relevance order (no sort is sent), server-rendered with a Polish-aware result count. - JournalSearchBox: an icon button and a WAI-ARIA combobox with debounced ?fields=suggest suggestions, stale answers dropped, query words marked ignoring diacritics; a plain GET form without JS. - The module keeps the search path out of the route cache and the sitemap and marks it noindex, follow. - Client: suggestPosts and the fields option; useJournalLinks.searchLink. --- .playground/app/app.vue | 3 + .playground/nuxt.config.ts | 2 + README.md | 39 ++++- app/assets/css/journal-base.css | 184 +++++++++++++++++++++ app/assets/css/journal-tokens.css | 2 + app/components/Journal/SearchBox.vue | 228 ++++++++++++++++++++++++++ app/composables/useJournalApi.ts | 4 +- app/composables/useJournalLinks.ts | 2 + app/journal-pages/SearchPage.vue | 77 +++++++++ app/utils/client.ts | 39 ++++- app/utils/routes.ts | 3 + app/utils/search.ts | 231 +++++++++++++++++++++++++++ app/utils/types.ts | 16 ++ i18n/locales/en.json | 22 +++ i18n/locales/pl.json | 22 +++ lib/journal-module.ts | 18 ++- package.json | 2 +- testing/expect-acme.txt | 23 +++ testing/fixture-api.mjs | 19 ++- tests/client.test.ts | 35 ++++ tests/routes.test.ts | 10 +- tests/search.test.ts | 203 +++++++++++++++++++++++ 22 files changed, 1170 insertions(+), 14 deletions(-) create mode 100644 app/components/Journal/SearchBox.vue create mode 100644 app/journal-pages/SearchPage.vue create mode 100644 app/utils/search.ts create mode 100644 tests/search.test.ts diff --git a/.playground/app/app.vue b/.playground/app/app.vue index f8eacfa..fa578f0 100644 --- a/.playground/app/app.vue +++ b/.playground/app/app.vue @@ -1,4 +1,7 @@