Skip to content

Commit db63ebd

Browse files
committed
🐛(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.
1 parent c5f018e commit db63ebd

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to
2020

2121
-🐛(frontend) table of content disappearing #982
2222
-🐛(frontend) fix multiple EmojiPicker #1012
23+
-🐛(frontend) fix meta title #1017
2324

2425

2526
## [3.3.0] - 2025-05-06

src/frontend/apps/impress/src/pages/_app.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default function App({ Component, pageProps }: AppPropsWithLayout) {
2626
<>
2727
<Head>
2828
<title>{t('Docs')}</title>
29+
<meta property="og:title" content={t('Docs')} key="title" />
2930
<meta
3031
name="description"
3132
content={t(

src/frontend/apps/impress/src/pages/docs/[id]/index.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ const DocPage = ({ id }: DocProps) => {
6767
useCollaboration(doc?.id, doc?.content);
6868
const { t } = useTranslation();
6969

70-
useEffect(() => {
71-
if (doc?.title) {
72-
setTimeout(() => {
73-
document.title = `${doc.title} - ${t('Docs')}`;
74-
}, 100);
75-
}
76-
}, [doc?.title, t]);
77-
7870
useEffect(() => {
7971
if (!docQuery || isFetching) {
8072
return;
@@ -142,7 +134,21 @@ const DocPage = ({ id }: DocProps) => {
142134
);
143135
}
144136

145-
return <DocEditor doc={doc} />;
137+
return (
138+
<>
139+
<Head>
140+
<title>
141+
{doc.title} - {t('Docs')}
142+
</title>
143+
<meta
144+
property="og:title"
145+
content={`${doc.title} - ${t('Docs')}`}
146+
key="title"
147+
/>
148+
</Head>
149+
<DocEditor doc={doc} />
150+
</>
151+
);
146152
};
147153

148154
const Page: NextPageWithLayout = () => {

0 commit comments

Comments
 (0)