Search leaves out the 404 page: searchContent, the search route, MCP search_content

searchContent / listContent read Site settings once (depth 0, homepage + notFound)
and skip unlistedPageIds; createSearchRoute and the MCP route pass settingsSlug.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 15:31:43 +01:00
co-authored by Claude Opus 5.5
parent 3645e61f7d
commit 6b2c9b3cc6
7 changed files with 58 additions and 9 deletions
+2 -1
View File
@@ -47,7 +47,8 @@ fifteen ready page sections and ten page templates.
`skip (not listed)`. The seed templates (`ipal-site`, `ipal-form`) read it.
### Fixed
- **Sitemap, llms.txt, the site index (MCP `list_pages`):** the page assigned as the 404 page is no longer listed —
- **Sitemap, llms.txt, the site index (MCP `list_pages`), search (`searchContent`, the search route, MCP
`search_content`):** the page assigned as the 404 page is no longer listed —
it answers 404 at its own address (`unlistedPageIds(settings)`). A 404 page that is also the homepage stays.
- **`buildImagesConfig` in production without R2:** with `R2_PUBLIC_URL` empty (the default: media served by the
app) the site's own `/api/media/file/**` on `NEXT_PUBLIC_SERVER_URL` is allowed, so next/image no longer answers
+3 -2
View File
@@ -390,7 +390,8 @@ Query: `?q=` (required), `?locale=`, `?limit=`. Response:
"results": [{ "title": "O nas", "url": "https://x/pl/o-nas", "description": "…", "slug": "o-nas" }] }
```
No `q` → 400. Published only, without `noindex` (`noindex` or `meta.noindex`),
No `q` → 400. Published only, without `noindex` (`noindex` or `meta.noindex`) and without the page assigned as the
404 page (Site settings → System pages, read through `settingsSlug`, default `site-settings`),
10 by default (`defaultLimit`), max 50 results. Under-construction mode:
pass `isPathVisible` from `createContentHelpers`, and hidden pages drop out of the results. Error/database
offline → empty result (200), not 500. **Rate limit:** 120/min per IP (in memory,
@@ -407,7 +408,7 @@ const results = await searchContent({ payload, query, config, locale, limit, bas
// SearchResult[] = { title, url, description?, slug }[]
```
`searchContent` options: `collection` (`'pages'`), `baseUrl`, `homeSlug`, `locale`
`searchContent` options: `collection` (`'pages'`), `baseUrl`, `homeSlug`, `settingsSlug` (`'site-settings'`, for the 404 page), `locale`
(default/invalid → `defaultLocale`), `limit` (10, clamped to 1–50),
`summaryField` (e.g. `'aiSummary'` — prefers the richer description from
`buildSummaryField` over `meta.description`; see [seo.md](./seo.md)). Never throws
+3 -2
View File
@@ -51,8 +51,9 @@ locale — the caller decides the fallback (404, redirect). A slug equal to
with a different slug, pass `homeSlug`.
**Pages with no URL of their own:** `unlistedPageIds(settings)` (root) → the ids of pages assigned to a role that
renders elsewhere — today the 404 page (unless it is also the homepage). The sitemap, llms.txt and the site index
(MCP `list_pages`) leave them out; use it in your own lists of pages too.
renders elsewhere — today the 404 page (unless it is also the homepage). The sitemap, llms.txt, the site index
(MCP `list_pages`) and search (`searchContent`, `createSearchRoute`, MCP `search_content`) leave them out; use it in your
own lists of pages too.
## Typical case: `/{locale}` → home page