Skip to content

Commit f58b3e7

Browse files
committed
preserve titlre
1 parent e8352bb commit f58b3e7

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

templates/base.html

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515

1616
<head>
1717
<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 %}
2023
</title>
21-
{% endblock title %}
2224

2325
<script src="{{ get_url(path='index.js', cachebust=true) | safe }}"></script>
2426

@@ -138,20 +140,23 @@
138140

139141
const content = doc.getElementById("portal");
140142
const navbar = doc.getElementById("navbar");
143+
const title = doc.getElementById("pagetitle");
141144

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};
144147
}
145148

146149
const navTo = async(link) => {
147150
const portal = document.getElementById("portal");
148151
const navbar = document.getElementById("navbar");
152+
const title = document.getElementById("pagetitle");
149153

150154
const potentialFetch = preFetched[link];
151155

152156
if(potentialFetch) {
153157
portal.replaceChildren(...potentialFetch.content.children);
154-
navbar.replaceChildren(...potentialFetch.navbar.children)
158+
navbar.replaceChildren(...potentialFetch.navbar.children);
159+
title.replaceWith(potentialFetch.title);
155160
} else {
156161
const newContents = await fetchLink(link);
157162

@@ -160,7 +165,8 @@
160165
}
161166

162167
portal.replaceChildren(...newContents.content.children);
163-
navbar.replaceChildren(...newContents.navbar.children)
168+
navbar.replaceChildren(...newContents.navbar.children);
169+
title.replaceWith(newContents.title);
164170
}
165171

166172
delete preFetched[link];

templates/operator_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% import "macros.html" as macros %}
33

44
{% block title %}
5-
<title>{{ section.title }} - OpenDream DM Reference</title>
5+
{{ section.title }} - OpenDream DM Reference
66
{% endblock title %}
77

88
{% block ogtitle %}

templates/proc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{% block title %}
55
{%- set potentialTitle = macros::render_page_parent_type(page=page, skip_level=1, recursive=false) | striptags | trim | safe -%}
6-
<title>{{ potentialTitle }}{% if potentialTitle %}/{% endif %}{{ page.title }}() - OpenDream DM Reference</title>
6+
{{ potentialTitle }}{% if potentialTitle %}/{% endif %}{{ page.title }}() - OpenDream DM Reference
77
{% endblock title %}
88

99
{% block ogtitle %}

templates/proc_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% import "macros.html" as macros %}
33

44
{% block title %}
5-
<title>{{ macros::render_page_parent_type(page=section, skip_level=0, recursive=false) | striptags | trim | safe }} procs - OpenDream DM Reference</title>
5+
{{ macros::render_page_parent_type(page=section, skip_level=0, recursive=false) | striptags | trim | safe }} procs - OpenDream DM Reference
66
{% endblock title %}
77

88
{% block ogtitle %}

templates/var.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{%- if potentialTitle == "Objects" -%}
77
{%- set potentialTitle = "/global" -%}
88
{%- endif -%}
9-
<title>{{ potentialTitle }}/{{ page.title }} - OpenDream DM Reference</title>
9+
{{ potentialTitle }}/{{ page.title }} - OpenDream DM Reference
1010
{% endblock title %}
1111

1212
{% block ogtitle %}

templates/var_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% import "macros.html" as macros %}
33

44
{% block title %}
5-
<title>{{ macros::render_page_parent_type(page=section, skip_level=0, recursive=false) | striptags | trim | safe }} vars - OpenDream DM Reference</title>
5+
{{ macros::render_page_parent_type(page=section, skip_level=0, recursive=false) | striptags | trim | safe }} vars - OpenDream DM Reference
66
{% endblock title %}
77

88
{% block ogtitle %}

0 commit comments

Comments
 (0)