Skip to content

Commit

Permalink
Merge pull request #719 from marcuswhybrow/fix/docs-html-lang
Browse files Browse the repository at this point in the history
Minor addition to the Getting Started documentation to prevent confusion around languages and result ids.
  • Loading branch information
bglw authored Nov 6, 2024
2 parents 5bcab17 + aface23 commit b820991
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/content/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ Loading this in your browser, you should see a search input on your page. Try se
The last required step is to run Pagefind after building your site on your CMS or hosting platform. If you're a CloudCannon user, add a [`.cloudcannon/postbuild`](https://cloudcannon.com/documentation/articles/extending-your-build-process-with-hooks/) file containing the npx command above (minus the `--serve` flag). For other platforms, set up an equivalent command to run after your site build — the end goal is that Pagefind will run after every build of your site before it is deployed.

For many use cases, you can stop here and mark it as complete. Or, you can dive deeper into Pagefind and configure it to your liking — check out [Configuring the index](/docs/indexing/) for some next steps.

## Notes

> For optimal performance, ensure the `lang` attribute is set on your `html` element. See [Multilingual Search](/docs/multilingual) for more details.
4 changes: 3 additions & 1 deletion docs/content/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This will return an object with the following structure:
{
results: [
{
id: "6fceec9",
id: "en_6fceec9",
data: async function data()
}
]
Expand All @@ -67,6 +67,8 @@ This will return an object with the following structure:
At this point you will have access to the number of search results, and a unique ID for each result. Also see [Debounced search](#debounced-search) below for an alternative API.
> Note that the prefix `en` in `en_6fceec9` matches the `lang` attribute of your `html` element. If `lang` is not set, the prefix defaults to `unknown`. See [Multilingual Search](/docs/multilingual) for more details.
## Loading a result
To reduce bandwidth usage, the data for each result (e.g. URL & title) must be loaded independently.
Expand Down

0 comments on commit b820991

Please sign in to comment.