Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions docs/userGuide/makingTheSiteSearchable.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,38 @@ In your `site.json`:

This tells Pagefind to exclude any element with the `algolia-no-index` class (or containing it in a space-separated list) from the search index, similar to using `data-pagefind-ignore`.

For more details, see the [Pagefind documentation on exclude selector configuration option](https://pagefind.app/docs/config-options/#exclude-selectors).

#### Limiting Which Pages Are Searchable

You can use the `glob` option to limit which pages are indexed by Pagefind. This is useful when you want search results to only show pages from specific sections of your site.
Pagefind uses the existing `searchable` property in your `pages` configuration to determine which pages should be indexed. This provides a seamless way to control search indexing without additional configuration.

In your `site.json`:

```json
{
"pagefind": {
"glob": [
"devGuide",
"userGuide/*"
]
}
"pages": [
{
"src": "index.md"
},
{
"src": "internal/notes.md",
"searchable": "no"
},
{
"glob": "devGuide/**/*.md",
"searchable": "no"
}
]
}
```

MarkBind supports glob patterns and will automatically append `.html` to your patterns if not specified. For example:
- `"devGuide"` becomes `"devGuide/**/*.html"`
- `"devGuide/*"` becomes `"devGuide/*.html"`
- `"**/devGuide/**"` becomes `"**/devGuide/**/*.html"`
- `"*.html"` remains `"*.html"` (no change needed)
- Pages with `searchable: "no"` (or `false`) will not appear in search results
- By default, all pages are searchable (`searchable: "yes"`)

Only pages matching these glob patterns will appear in search results. This can be particularly useful for:
- Multi-site setups where you want to search only specific sections
- Including only certain directories from search results
This integrates with Pagefind's `data-pagefind-body` attribute. Pages with `searchable: false` will not have this attribute in their HTML, preventing them from being indexed by Pagefind.

Comment thread
gerteck marked this conversation as resolved.
Outdated
For more details on glob patterns, see the [Pagefind documentation](https://pagefind.app/docs/config-options/#glob).
For more details on the `searchable` property, see [site.json file documentation](siteJsonFile.html#pages).

<panel header="Potential Future Enhancements">

Expand Down
2 changes: 1 addition & 1 deletion docs/userGuide/siteJsonFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ _(Optional)_ **The styling options to be applied to the site.** This includes:
* **`globExclude`**: An array of file patterns to be excluded from rendering when using `glob`, also defined in the glob syntax.
* **`title`**: The page `<title>` for the generated web page. Titles specified here take priority over titles specified in the [frontmatter](tweakingThePageStructure.html#frontmatter) of individual pages.
* **`layout`**: The [layout](tweakingThePageStructure.html#layouts) to be used by the page. Default: `default`.
* **`searchable`**: Specifies that the page(s) should be excluded from searching. Default: `yes`.
* **`searchable`**: Specifies whether the page(s) should be included in search indexing. This applies to both the built-in search and Pagefind (if enabled). Set to `"no"` or `false` to exclude the page(s) from search results. Default: `yes`.
* **`externalScripts`**: An array of external scripts to be referenced on the page. Scripts referenced will be run before the layout script.
* **`frontmatter`**: Specifies properties to add to the frontmatter of a page or glob of pages. Overrides any existing properties if they have the same name, and overrides any frontmatter properties specified in `globalOverride`.
* **`fileExtension`**: A string that specifies the output file extension (e.g., `".json"`, `".txt"`) for the generated file. If not specified, defaults to `".html"`. Note that non-HTML files do not support frontmatter or scripts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/functional/test_site/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-bs-spy="scroll" data-bs-target="#mb-page-nav" data-bs-offset="100" data-code-theme="dark">
<body data-bs-spy="scroll" data-bs-target="#mb-page-nav" data-bs-offset="100" data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">
<div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">
<div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">
<div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">
<div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">
<div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">
<div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">
<div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
const baseUrl = '/test_site'
</script>

<body data-code-theme="dark">
<body data-pagefind-body data-code-theme="dark">
<div id="app">

<div>
Expand Down
Loading
Loading