-
I have pages[] defined in config. It seams that search only indexes the top level of pages[]. How can I have it index all pages in pages[]? That is, without having to add |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
All the pages are indexed, by default. Please provide more details so we can understand what's happening in your case. |
Beta Was this translation helpful? Give feedback.
-
Ah, well, sorry about being so terse. Here you go. Unlike https://observablehq.com/framework/, which has pages (leaves) at level 1 and 2 (root being level 0), my setup has most pages at level 3, as I have to include an extra indirection layer because I potentially have hundreds of pages. For example, http://aarde.aardrock.nl/money shows a TOC of all pages relating to Money and is listed in the sidebar under ‘Aardbron’. One of these ‘Money’ pages is about Flow Money. It’s logical path is aarde/aardbron/money/flow-money, so at level 3. Searching for ‘evil’ does find the Money category page, as it is on level 2. But searching for ‘geld’ (Dutch for money) only finds two pages, one of them being http://aarde.aardrock.nl/aardbron. This while there are about 50 pages that mention ‘geld’.
For instance, the ‘Money’ category used by ‘Aardbron’, containing the page ‘Flow money’ is defined in zones/aardbron.js As another example, searching for ‘martien’ lists only four results, while there are 15 distinct pages that contain that text. My initial thought is that only two levels are supported by both the sidebar and search. I understand and respect the choice for not supporting nested sections in the sidebar. However, I very much want ALL pages to be indexed so they can be found. A global option to turn this off or on would be fine. Thoughts? |
Beta Was this translation helpful? Give feedback.
The pages option is a list of pages and sections — sections being lists of pages. There is no third level. The option is normalized here:
https://github.com/observablehq/framework/blob/main/src/config.ts#L440
Anything that you add to this option and does not fit this expected shape is ignored. If your site structure is different from the expected, you can add a search: true statement in the relevant pages’ front-matter. It's what I do in pangea.