-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
feat(v2): add site title to meta title #2255
Conversation
Deploy preview for docusaurus-2 ready! Built with commit fa1710f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can we change to either -
or |
? Self-merge
{title && <title>{title}</title>} | ||
{title && ( | ||
<title> | ||
{title} · {siteTitle} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using -
or |
will be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yangshun done, but what about avoiding to use tagline if there is no title? I mentioned this in the PR description.
${siteTitle} · ${tagline}
-> ${siteTitle}
Instead, use tagline only on the home page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Don't use tagline elsewhere. I think if the tagline is too long it even looks weird to have it as the <title> on the homepage, just like ours :S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excluded tagline from meta title of any page, but bring back it to title on home page.
Motivation
Resolves https://docusaurus.canny.io/admin/board/feature-requests/p/allow-browser-tab-title-to-have-a-prefix
Bcause this is the expected behavior (especially since it was in v1) - the site name is usually contained in the title itself and this is suitable for most websites (+ better for SEO).
The only thing I'm not sure about existing a tagline in the case when the title is not set, in v1 there was even a separate config parameter (
disableTitleTagline
) that removes the tagline from the final meta title, but I do not think it is a good idea to implement it in v2.docusaurus/packages/docusaurus-1.x/lib/core/Site.js
Lines 38 to 42 in 7e60a28
Maybe then do not include the tagline in the meta title, after all, this is typical only for the home page, for other pages without a title it is better to just use site title (IMO).
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Make sure site title is included in meta title (docs/blog/pages).
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)