tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
291
fork
atom
a tool for shared writing and social publishing
291
fork
atom
overview
issues
27
pulls
pipelines
fix title on pub leaflets
awarm.space
10 months ago
561af444
e3fa029e
+6
-1
1 changed file
expand all
collapse all
unified
split
components
utils
UpdateLeafletTitle.tsx
+6
-1
components/utils/UpdateLeafletTitle.tsx
···
12
12
import { useParams, useRouter, useSearchParams } from "next/navigation";
13
13
import { focusBlock } from "src/utils/focusBlock";
14
14
import { useIsMobile } from "src/hooks/isMobile";
15
15
+
import { useLeafletPublicationData } from "components/PageSWRDataProvider";
15
16
16
17
export function UpdateLeafletTitle(props: { entityID: string }) {
18
18
+
let { data: pubData } = useLeafletPublicationData();
17
19
let firstPage = useEntity(props.entityID, "root/page")[0];
18
20
let entityID = firstPage?.data.value || props.entityID;
19
21
···
23
25
let firstBlock = blocks[0];
24
26
let title = usePageTitle(entityID);
25
27
useEffect(() => {
28
28
+
if (pubData[0].title) {
29
29
+
document.title = pubData[0].title;
30
30
+
}
26
31
if (title) {
27
32
document.title = title;
28
33
}
29
29
-
}, [title]);
34
34
+
}, [title, pubData]);
30
35
let params = useSearchParams();
31
36
let focusFirstBlock = params.get("focusFirstBlock");
32
37
let router = useRouter();