Customize generated title (omit suffix) #6640
Replies: 2 comments
-
No easy way, unfortunately, but it's worth opening a feature request for that. We have a export const useTitleFormatter = (title?: string | undefined): string => {
const {siteConfig} = useDocusaurusContext();
const {title: siteTitle, titleDelimiter} = siteConfig;
return title && title.trim().length
? `${title.trim()} ${titleDelimiter} ${siteTitle}`
: siteTitle;
};
Actually, this works if you add the A temporary solution: swizzle wrap both the Layout/Seo components to override our logic: https://docusaurus.io/docs/advanced/swizzling#wrapping-theme-components import Layout from '@theme-original/Layout';
import React from 'react';
export default function LayoutWrapper(props) {
return (
<>
<Layout {...props} />
<Head titleTemplate="%s | MySuffix">
{props.title && <title>{props.title}</title>}
</Head>
</>
);
} ( |
Beta Was this translation helpful? Give feedback.
-
See #5878 |
Beta Was this translation helpful? Give feedback.
-
Is there a way to customize the generated title?
We don't want to add the
| SiteTitle
suffix for blog posts. I tried to addbut it doesn't work.
Beta Was this translation helpful? Give feedback.
All reactions