docusaurus: Customize page title per plugin instance - avoid duplicated page title
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand 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
By default, the landing page name repeats itself, i.e. “Auth with Caddy | Auth with Caddy”.

Steps to reproduce
Please see the landing page of https://authp.github.io/
Expected behavior
The page name should not repeat, i.e. be “Auth with Caddy”.
Actual behavior
The name repeats itself “Auth with Caddy | Auth with Caddy”.

Your environment
- Public source code: https://github.com/authp/authp.github.io
- Public site URL: https://authp.github.io/
- Docusaurus version used:
2.0.0-beta.9 - Environment name and version (e.g. Chrome 89, Node.js 16.4): Node v14.17.6
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): CentOS 8
Reproducible demo
No response
Self-service
- I’d be willing to fix this bug myself.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 15 (1 by maintainers)
You can omit the
titlefield in the home page layout:And I do think there’s something we can do: check if site title is equal to page title, and do not duplicate if that’s the case:
https://github.com/facebook/docusaurus/blob/cbcaa52f88cb702a3712c2b4c19b02225f975ea9/packages/docusaurus-theme-common/src/utils/generalUtils.ts#L12-L14
#11090 is a nice feature, but it seems the
<title>and<meta name="og:title">are still required to be the same. Would it be possible to make these different? For example, it’s common for sites to specifyog:title+og:site_namemetadata separately, and then use<title>{title} | {siteName}</title>for the traditional title.The use-case will be solved by https://github.com/facebook/docusaurus/pull/11090 in v3.8
For now, the API is not perfect, but it is the most flexible: you will need to swizzle a small theme component, which makes it possible to provide your own code logic instead of dealing with a static string template.
We may provide a
siteConfigoption later.I’d also like to collect feedback before implementing a new public
siteConfigAPI. For example: are the provided callback params enough to solve most use cases?Maybe we’ll also want to deprecate
siteConfig.titleDelimiterlater if we have a more powerful API.In the future, we’ll likely implement an API to assign a “label” to a plugin instance. For example, you may have 2 docs plugin instance (
iOS+Android). Plugin ids are used for file system paths, and are not meant to be displayed in meta title. So a plugin instance label would look cleaner to display in a title.We also need this for docs breadcrumbs, where we’d want a breadcrumb such as
Home > iOS > My iOS doc page, see related issues:@Josh-Cena , thank you! This change from defaults worked! 👍
Yes, that would be great!
Additionally, it would be nice to have
"Page Name" | "Instance Name" | "Site Title"in the case of multi-doc instance.For example, I have two pages:
Auth Portal Plugin Overview | Auth with CaddyAuthorize Plugin Overview | Auth with CaddyIt would be nice to have instance name (i.e.
AuthenticateandAuthorize) taken into account.Auth Portal Plugin Overview | Authenticate | Auth with CaddyAuthorize Plugin Overview | Authorize | Auth with Caddy