Repository navigation
Customize generated title (omit suffix) #6640
Unanswered
Samrose-Ahmed
asked this question in
Q&A
Replies: 3 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>
</>
);
}( |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is there a way to customize the generated title?
We don't want to add the
| SiteTitlesuffix for blog posts. I tried to addbut it doesn't work.
All reactions