|
15 | 15 |
|
16 | 16 | <head> |
17 | 17 | <meta charset="utf-8" /> |
18 | | - {% block title %} |
19 | | - <title>{{pageOrSubsection.title }}{% if not pageOrSubsection.path == "/" %} - OpenDream DM Reference{% endif %} |
| 18 | + |
| 19 | + <title id="pagetitle"> |
| 20 | + {% block title %} |
| 21 | + {{pageOrSubsection.title }}{% if not pageOrSubsection.path == "/" %} - OpenDream DM Reference{% endif %} |
| 22 | + {% endblock title %} |
20 | 23 | </title> |
21 | | - {% endblock title %} |
22 | 24 |
|
23 | 25 | <script src="{{ get_url(path='index.js', cachebust=true) | safe }}"></script> |
24 | 26 |
|
|
138 | 140 |
|
139 | 141 | const content = doc.getElementById("portal"); |
140 | 142 | const navbar = doc.getElementById("navbar"); |
| 143 | + const title = doc.getElementById("pagetitle"); |
141 | 144 |
|
142 | | - if(pre) preFetched[link] = {content: content, navbar: navbar}; |
143 | | - return {content: content, navbar: navbar}; |
| 145 | + if(pre) preFetched[link] = {content: content, navbar: navbar, title: title}; |
| 146 | + return {content: content, navbar: navbar, title: title}; |
144 | 147 | } |
145 | 148 |
|
146 | 149 | const navTo = async(link) => { |
147 | 150 | const portal = document.getElementById("portal"); |
148 | 151 | const navbar = document.getElementById("navbar"); |
| 152 | + const title = document.getElementById("pagetitle"); |
149 | 153 |
|
150 | 154 | const potentialFetch = preFetched[link]; |
151 | 155 |
|
152 | 156 | if(potentialFetch) { |
153 | 157 | portal.replaceChildren(...potentialFetch.content.children); |
154 | | - navbar.replaceChildren(...potentialFetch.navbar.children) |
| 158 | + navbar.replaceChildren(...potentialFetch.navbar.children); |
| 159 | + title.replaceWith(potentialFetch.title); |
155 | 160 | } else { |
156 | 161 | const newContents = await fetchLink(link); |
157 | 162 |
|
|
160 | 165 | } |
161 | 166 |
|
162 | 167 | portal.replaceChildren(...newContents.content.children); |
163 | | - navbar.replaceChildren(...newContents.navbar.children) |
| 168 | + navbar.replaceChildren(...newContents.navbar.children); |
| 169 | + title.replaceWith(newContents.title); |
164 | 170 | } |
165 | 171 |
|
166 | 172 | delete preFetched[link]; |
|
0 commit comments