File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 < meta charset ="UTF-8 " />
55 < link rel ="icon " type ="image/svg+xml " href ="/favicon.svg " />
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7- < title > frontend </ title >
7+ < title > JustWiki </ title >
88 </ head >
99 < body >
1010 < div id ="root "> </ div >
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ export default function Home() {
1010 const { allTags, fetchAllTags } = useTags ( )
1111 const [ page , setPage ] = useState ( 1 )
1212
13+ useEffect ( ( ) => {
14+ document . title = 'Home - JustWiki'
15+ return ( ) => { document . title = 'JustWiki' }
16+ } , [ ] )
17+
1318 useEffect ( ( ) => {
1419 fetchPages ( page , PER_PAGE )
1520 fetchAllTags ( )
Original file line number Diff line number Diff line change @@ -167,6 +167,15 @@ export default function PageView() {
167167 setPublicConfirmOpen ( false )
168168 }
169169
170+ useEffect ( ( ) => {
171+ if ( page ?. title ) {
172+ document . title = `${ page . title } - JustWiki`
173+ } else {
174+ document . title = 'JustWiki'
175+ }
176+ return ( ) => { document . title = 'JustWiki' }
177+ } , [ page ?. title ] )
178+
170179 if ( loading ) return < div className = "text-text-secondary" > Loading...</ div >
171180 if ( ! page ) return null
172181
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ export default function PublicPageView({ notFound }) {
5656 } )
5757 } , [ slug ] )
5858
59+ useEffect ( ( ) => {
60+ if ( state . page ?. title ) {
61+ document . title = `${ state . page . title } - JustWiki`
62+ } else {
63+ document . title = 'JustWiki'
64+ }
65+ return ( ) => { document . title = 'JustWiki' }
66+ } , [ state . page ?. title ] )
67+
5968 // Until the fetch for the current slug resolves, show a loading screen.
6069 // state.slug tracks which slug the current data belongs to so a stale
6170 // render of a different slug doesn't leak across navigations.
You can’t perform that action at this time.
0 commit comments