mirror of
https://github.com/suitenumerique/docs
synced 2026-04-21 13:37:20 +00:00
🐛(frontend) fix meta title
The meta title was flickering, it was adding the doc title, then it was coming back to the default title. This was due to the way the next Head component render data. We now use a more stable way to set the title.
This commit is contained in:
parent
c5f018e03e
commit
db63ebd0c8
3 changed files with 17 additions and 9 deletions
|
|
@ -20,6 +20,7 @@ and this project adheres to
|
|||
|
||||
-🐛(frontend) table of content disappearing #982
|
||||
-🐛(frontend) fix multiple EmojiPicker #1012
|
||||
-🐛(frontend) fix meta title #1017
|
||||
|
||||
|
||||
## [3.3.0] - 2025-05-06
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export default function App({ Component, pageProps }: AppPropsWithLayout) {
|
|||
<>
|
||||
<Head>
|
||||
<title>{t('Docs')}</title>
|
||||
<meta property="og:title" content={t('Docs')} key="title" />
|
||||
<meta
|
||||
name="description"
|
||||
content={t(
|
||||
|
|
|
|||
|
|
@ -67,14 +67,6 @@ const DocPage = ({ id }: DocProps) => {
|
|||
useCollaboration(doc?.id, doc?.content);
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
if (doc?.title) {
|
||||
setTimeout(() => {
|
||||
document.title = `${doc.title} - ${t('Docs')}`;
|
||||
}, 100);
|
||||
}
|
||||
}, [doc?.title, t]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!docQuery || isFetching) {
|
||||
return;
|
||||
|
|
@ -142,7 +134,21 @@ const DocPage = ({ id }: DocProps) => {
|
|||
);
|
||||
}
|
||||
|
||||
return <DocEditor doc={doc} />;
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>
|
||||
{doc.title} - {t('Docs')}
|
||||
</title>
|
||||
<meta
|
||||
property="og:title"
|
||||
content={`${doc.title} - ${t('Docs')}`}
|
||||
key="title"
|
||||
/>
|
||||
</Head>
|
||||
<DocEditor doc={doc} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const Page: NextPageWithLayout = () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue