Skip to content
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

Algolia placeholder does not work docusaurus.config.js file. #10774

Closed
7 tasks done
FlyNumber opened this issue Dec 16, 2024 · 1 comment · Fixed by #10799
Closed
7 tasks done

Algolia placeholder does not work docusaurus.config.js file. #10774

FlyNumber opened this issue Dec 16, 2024 · 1 comment · Fixed by #10799
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@FlyNumber
Copy link

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

According to https://docusaurus.io/docs/search#customizing-the-algolia-search-behavior

We can use

placeholder
type: string | default: "Search docs" | optional

The placeholder of the input of the DocSearch pop-up modal.

... this does not work and we get a TS error

theme-search-algolia.d.ts(12, 5): The expected type comes from property 'algolia' which is declared here on type 'ThemeConfig'

Reproducible demo

No response

Steps to reproduce

Add placeholder to Algolia field in Docusaurus config

Expected behavior

Search box modal would use my value instead of the default "Search docs"

Actual behavior

TS error

theme-search-algolia.d.ts(12, 5): The expected type comes from property 'algolia' which is declared here on type 'ThemeConfig'

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.
@FlyNumber FlyNumber added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Dec 16, 2024
@slorber
Copy link
Collaborator

slorber commented Dec 26, 2024

Note that you can already provide a custom label by using our i18n support: we consider those labels are translatable i18n english labels, so translating english labels will permit to customize the labels. You can also swizzle @theme/SearchTranslations.

Will be fixed in #10799 since I agree using our i18n system for customizing such label is a bit awkward and unintuitive if your site is not localized.

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants