Skip to content

Commit 88deb77

Browse files
committed
replace titles
1 parent ae5acc8 commit 88deb77

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

prepare_deploy.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ def convert_notebooks(selected_nb_re=None):
128128
app.notebooks = [os.path.join(path,filename)]
129129
app.start()
130130

131+
# HACK to set title and other things in rendered notebook
132+
html_filename = "{}.html".format(os.path.join(html_base,cleanbase))
133+
with open(html_filename, 'rb') as f:
134+
html_file_data = f.read()
135+
136+
with open(html_filename, 'wb') as f:
137+
html_file_data = html_file_data.decode("utf-8")
138+
html_file_data = html_file_data.replace("{title}",
139+
nb['metadata']['astropy-tutorials']['link_name'])
140+
f.write(html_file_data.encode("utf8"))
141+
131142
index_listing = dict()
132143
index_listing["link_path"] = "{}.html".format(cleanbase)
133144
index_listing["link_name"] = nb['metadata']['astropy-tutorials']['link_name']

templates/astropy.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block header %}
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
55

6-
<title></title>
6+
<title>{title}</title>
77

88
{{ super() }}
99

0 commit comments

Comments
 (0)