Skip to content

Conversation

@dylantientcheu
Copy link

@dylantientcheu dylantientcheu commented Jul 28, 2025

Description

Upgrade DocSearch to v4 in the Astro docs theme.
This bumps the dependency, wires the new API, and optionally exposes Ask AI.

Additional Context & Motivation

image
  • 10 years of DocSearch – a decade of better docs discovery

  • 5 years since v3 – time for a fresh UI/UX and new features

  • We 💙 Astro – first-class integration matters

  • DocSearch v4 ships a redesigned modal, better accessibility, mobile polish, and is still 💯 free.

  • Ask AI (opt-in) layers conversational Q&A on top of your Algolia index.

What’s in this PR

  • upgrade @algolia/docsearch-astro → latest stable v4
  • expose new askAi prop in DocSearch.astro
  • inject extra i18n strings for DocSearch v4 / Ask AI

Playground: https://community.algolia.com/docsearch-playground/
Demo video:

Screen.Recording.2025-07-28.at.12.53.00.2.1.mp4

Features

DocSearch v4

• Modernised UI • Faster load • Recent & favourite searches • Dark-mode aware • ARIA-improved

Ask AI (optional)

• Natural-language Q&A • Free • BYOLLM • Pulls context from your Algolia index • Conversation history

Related Docs

@changeset-bot
Copy link

changeset-bot bot commented Jul 28, 2025

🦋 Changeset detected

Latest commit: e060e93

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight-docsearch Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jul 28, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit e060e93
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/690330a9b982050008805990
😎 Deploy Preview https://deploy-preview-3346--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🔴 down 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added i18n Anything to do with internationalization & translation efforts 📚 docs Documentation website changes 🌟 docsearch Changes to Starlight’s DocSearch plugin labels Jul 28, 2025
@astrobot-houston
Copy link
Contributor

Hello! Thank you for opening your first PR to Starlight! ✨

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🤩

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented Jul 28, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/site-search.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @dylantientcheu!

I’ll take a proper look later, but quick heads up that this PR should only change the English language docs, not the others. Then our translation contributors will PR translations of the updated content. (At least, I’m assuming you’re not fluent in all of these languages 😁)

Should make it easier for you to contribute that way, and easier for us to review too.

@dylantientcheu
Copy link
Author

Thanks @delucis.

I just updated the docs files. If you need to test the integration, use this commit changes: https://github.com/withastro/starlight/compare/4da4fcc8be9a9d2ba2a44c760c645018c0834795..3e8a040af25fee712d1a7a4b2564c690c0a63975

I had to remove it to keep the PR lean.

@dylantientcheu
Copy link
Author

dylantientcheu commented Jul 30, 2025

For some reason, I'm unable to make "favoriting" results and "deleting recent searches" function properly. Maybe the event can't propagate properly?

I have no apparent error and I'm having a hard time debugging this. @delucis please, let me know if something pops out during your review

@NatanTechofNY
Copy link

NatanTechofNY commented Aug 15, 2025

Hey @delucis any chance we can get some eyes on this or merge it? There are a few folks waiting for it. Please let us know!

@delucis
Copy link
Member

delucis commented Aug 15, 2025

Hi @NatanTechofNY and @dylantientcheu — yes, thanks for your patience!

Do you have a rough timeline of when you’re planning for v4 to move out of beta? I’ll obviously go ahead and review, but I guess we’d time a release to align with the stable v4 release.

Copy link
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution 🙌

While waiting for a timeline for a stable release, I went through the changes for an early review (mostly code, I did not take a good look at the docs changes yet) and left a few comment/questions I have.

Also linking to https://docsearch.algolia.com/docs/migrating-from-v3#translations as a reminder which should be helpful when drafting the changeset for the changes to make sure we include the updated translation keys.

@NatanTechofNY
Copy link

NatanTechofNY commented Aug 19, 2025

Thanks for the review @HiDeoo and @delucis, we are aiming for our v4 stable release in the next 2 weeks. We will make the review adjustments

@saif-at-scalekit
Copy link
Contributor

Looking forward 🥇 , @NatanTechofNY !

@dylantientcheu
Copy link
Author

@HiDeoo thanks for the thorough review.

I just pushed a few changes to resolve these comments. Let me know if it works for you!

@dylantientcheu dylantientcheu requested a review from HiDeoo August 26, 2025 08:49
Copy link
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update 🙌

I left a few final suggestions mostly to clean up some types and to avoid some type-checking issues but this is looking great! From my local testing using the shared playground configuration, I did not run into any issues.

I'll let Chris take a final look as he's the more familiar with the plugin as he built it and he's more familiar with DocSearch specifically than I am.

Congrats on the new major 👏

@NatanTechofNY
Copy link

@HiDeoo @delucis We have released our stable version. Let us know when this is good to be merged! Thank you

@dylantientcheu
Copy link
Author

Thanks for the insight i'll work on this.

@dylantientcheu
Copy link
Author

@HiDeoo we just upgraded to 4.2 which fixes this issue.
The PR should be ready 👍🏽. Please LMK if that works for you.

Important

Remember the values in astro.config.mjs L194-199 are purely for demo purposes and should not go into production

Copy link
Contributor

@trueberryless trueberryless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 🙌

I think we need a changeset for the @astrojs/starlight-docsearch package. I suggest a minor bump which describes the update to the docsearch package v4 👍

Do you know how to do that?
If not, you should be able to run pnpm changeset and follow the instructions, if unclear, the maintainers can also do that I think 🚀

@dylantientcheu
Copy link
Author

@trueberryless done :)

Copy link
Contributor

@trueberryless trueberryless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome progress 🙌

I left a small comment refining the changeset wording to better fit Astro's changeset guidelines.

Another question: Could you maybe update the PR description to be up-to-date? Eg it currently mentions "beta" updates, but this was in the past, now we are stable 🥳

@dylantientcheu dylantientcheu changed the title feat(search): upgrade DocSearch to v4-beta feat(search): upgrade DocSearch to v4 Oct 13, 2025
@dylantientcheu
Copy link
Author

@trueberryless not to hurry you.

We have a few starlight users that are closely watching this PR. When they ping us, we can't do much, we'd love to get this merged :)

@trueberryless
Copy link
Contributor

Good things take time 😅

From my side, I have nothing to add or reject, but please note that I am not a maintainer. Chris and/or HiDeoo will probably take another close look at the changes.

I am deliberately not giving any time frame; all contributors and maintainers are doing this voluntarily, so I kindly ask for your understanding! Nonetheless, I am already looking forward to this upgrade myself.

Copy link
Contributor

@randomguy-2650 randomguy-2650 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left two tiny comments that don’t affect usability at all, just branding and I’m not really sure what to classify the other one as.

Copy link
Contributor

@randomguy-2650 randomguy-2650 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

One tiny UI issue I’ve found is this dropdown in Ask AI:

Screenshot of Algolia DocSearch v4.2.0 Ask AI interface showing a dropdown visibility bug

There isn’t a background, at least on Safari 26 on iOS 26.0.1.

You can check this on other browsers, not sure if this is an Algolia issue or Starlight issue.

Comment on lines +194 to +199
starlightDocSearch({
appId: 'PMZUYBQDAK',
apiKey: '24b09689d5b4223813d9b8e48563c8f6',
indexName: '[Demo][Tmp] Astro Starlight',
askAi: 'askAIDemo'
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume all of this would be removed later, right? Because the Starlight docs use the default search, Pagefind, by default.

This is just to remind you just in case you forget.

Comment on lines 20 to +21
"@astrojs/starlight": "workspace:*",
"@astrojs/starlight-docsearch": "workspace:*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well. Replace it with the published versions in the future rather than workspace:*.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use workspace here because the package is local. We'll not need it, when we'll remove the top comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 docs Documentation website changes 🌟 docsearch Changes to Starlight’s DocSearch plugin i18n Anything to do with internationalization & translation efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants