Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion components/HtmlHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ const HtmlHead = ({ frontMatter }: HeaderProps) => {
const pageTitle = frontMatter.title || siteConfig.title;
const canonicalLink = `https://nodejs.org${route}`;

// "{pageTitle} | {siteConfig.title}" if pageTitle is defined
const title =
// avoid "Node.js | Node.js" title
pageTitle && pageTitle !== siteConfig.title
Copy link
Author

Choose a reason for hiding this comment

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

📝 Some page's ${pageTitle} is "Node.js" and I avoid "Node.js | Node.js".

  • http://localhost:3000/en/: { pageTitle: 'Node.js', siteConfigTitle: 'Node.js' }
  • http://localhost:3000/en/blog/: { pageTitle: 'Node.js', siteConfigTitle: 'Node.js' }

Copy link
Member

Choose a reason for hiding this comment

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

I think this is extra logic. Only the pageTitle should be updated.

? `${pageTitle} | ${siteConfig.title}`
: siteConfig.title;
return (
<Head>
<title>{siteConfig.title}</title>
<title>{title}</title>

<meta name="theme-color" content={siteConfig.accentColor}></meta>

Expand Down