-
Notifications
You must be signed in to change notification settings - Fork 0
Add Algolia DocSearch integration with sitemap and enhanced documentation #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Algolia DocSearch integration with sitemap and enhanced documentation #45
Conversation
|
@copilot also add a sitemap to make algolia crawler more efficient. |
|
@copilot Make the documentation a little more fun to read by adding a tasteful amount of emojis like other modern open source documentation projects |
Co-authored-by: graknol <1364029+graknol@users.noreply.github.com>
Added explicit sitemap configuration in commit c0b91d5. The sitemap is now configured with lastmod dates, weekly changefreq, and includes all documentation pages for efficient Algolia crawler indexing. The sitemap.xml is automatically generated at build time and will be available at https://declarative-sqlite.linden.no/sitemap.xml after deployment. |
|
@copilot Algolia crawler does not like redirects and will not follow them. I have identified the issue, it's because our links do not have a trailing slash "/" at the end of each URL, but github pages requires them, so they redirect us to the trailing slash version. The sitemap should at least have the trailing slash so we at least get the main pages indexed. |
Co-authored-by: graknol <1364029+graknol@users.noreply.github.com>
Added tasteful emojis throughout the documentation in commit 2e9f533. The emojis enhance visual navigation and make the docs more welcoming while maintaining professionalism, similar to modern open source projects. Examples of emoji usage:Emojis were added to:
All 15 documentation pages have been updated with contextually appropriate emojis. |
Co-authored-by: graknol <1364029+graknol@users.noreply.github.com>
Fixed in commit 8ed46ab by adding All 16 documentation pages now have trailing slashes:
The Algolia crawler can now index all pages directly without following redirects. |





Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.
Changes Made
Sitemap Configuration
docs/docusaurus.config.tswithin the@docusaurus/preset-classicpreset optionslastmod: 'date'to include modification dates for efficient crawler updateschangefreq: 'weekly'to inform crawlers about expected update frequencyignorePatterns: ['/tags/**']to exclude non-documentation pagestrailingSlash: trueto ensure all URLs include trailing slashes, preventing GitHub Pages redirects that block the Algolia crawlerDocumentation Updates
docs/ALGOLIA_SEARCH_SETUP.mdwith a new "Sitemap Configuration" sectionhttps://declarative-sqlite.linden.no/sitemap.xmlDocumentation Enhancements
Benefits
The sitemap configuration helps the Algolia crawler:
<lastmod>dates to identify recently changed pages<changefreq>hints<priority>tagsThe emoji enhancements provide:
Verification
/sitemap.xmlScreenshots
Sitemap with Trailing Slashes:
Documentation with Emojis:
Note: The
@docusaurus/preset-classicalready includes both the Algolia theme component (@docusaurus/theme-search-algolia) and sitemap plugin as transitive dependencies, so no additional package installation was needed.Original prompt
I have added algolia app id and api key and the index name to the configuration. But i think you forgot to add the algolia theme component package per the documentation:
Search
There are a few options you can use to add search to your website:
🥇 Algolia DocSearch (official)
👥 Typesense DocSearch
👥 Local Search
👥 Your own SearchBar component
info
🥇 Docusaurus provides first-class support for Algolia DocSearch.
👥 Other options are maintained by the community: please report bugs to their respective repositories.
🥇 Using Algolia DocSearch
Docusaurus has official support for Algolia DocSearch.
The service is free for any developer documentation or technical blog: just make sure to read the checklist and apply to the DocSearch program.
DocSearch crawls your website once a week (the schedule is configurable from the web interface) and aggregates all the content in an Algolia index. This content is then queried directly from your front-end using the Algolia API.
If your website is not eligible for the free, hosted version of DocSearch, or if your website sits behind a firewall and is not public, then you can run your own DocSearch crawler.
note
By default, the Docusaurus preset generates a sitemap.xml that the Algolia crawler can use.
From the old docsearch?
You can read more about migration from the legacy DocSearch infra in our blog post or the DocSearch migration docs.
Index Configuration
After your application has been approved and deployed, you will receive an email with all the details for you to add DocSearch to your project. Editing and managing your crawls can be done via the web interface. Indices are readily available after deployment, so manual configuration usually isn't necessary.
Use the recommended crawler config
It is highly recommended to use our official Docusaurus v3 crawler configuration. We cannot support you if you choose a different crawler configuration.
When updating your crawler config
The crawler configuration contains a initialIndexSettings, which will only be used to initialize your Algolia index if it does not exist yet.
If you update your initialIndexSettings crawler setting, it is possible to update the index manually through the interface, but the Algolia team recommends to delete your index and then restart a crawl to fully reinitialize it with the new settings.
Connecting Algolia
Docusaurus' own @docusaurus/preset-classic supports Algolia DocSearch integration. If you use the classic preset, no additional installation is needed.
Installation steps when not using @docusaurus/preset-classic
Then, add an algolia field in your themeConfig. Apply for DocSearch to get your Algolia index and API key.
docusaurus.config.js
export default {
// ...
themeConfig: {
// ...
algolia: {
// The application ID provided by Algolia
appId: 'YOUR_APP_ID',
},
};
info
The searchParameters option used to be named algoliaOptions in Docusaurus v1.
Refer to its official DocSearch documentation for possible values.
warning
The search feature will not work reliably until Algolia crawls your site.
If search doesn't work after any significant change, please use the Algolia dashboard to trigger a new crawl.
Contextual search
Contextual search is enabled by default.
It ensures that search results are relevant to the current language and version.
docusaurus.config.js
export default {
// ...
themeConfig: {
// ...
algolia: {
contextualSearch: true,
},
},
};
Let's consider you have 2 docs versions (v1 and v2) and 2 languages (en and fr).
When browsing v2 docs, it would be odd to return search resul...
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.