From 1913453ca587fb56e9c07489090c8479d97f9c00 Mon Sep 17 00:00:00 2001 From: Mario Buikhuizen Date: Fri, 13 Dec 2019 19:09:31 +0100 Subject: [PATCH] fix: the default title in the template is always Notebook The property used as a fallback for the title of the template is not initialized by Voila. Following nbconvert, in which this property is set to the filename of the notebook [1], this commit now does the same. Related to: voila-dashboards/voila-vuetify#25 [1] https://github.com/jupyter/nbconvert/blob/6c6e5fa0c757169017fd325fad98efa8d4a368ea/nbconvert/exporters/exporter.py#L172 --- voila/handler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/voila/handler.py b/voila/handler.py index 30e58f4a9..ecf50f3e3 100644 --- a/voila/handler.py +++ b/voila/handler.py @@ -59,11 +59,17 @@ async def get(self, path=None): return self.cwd = os.path.dirname(notebook_path) + path, basename = os.path.split(notebook_path) + notebook_name = os.path.splitext(basename)[0] + # render notebook to html resources = { 'base_url': self.base_url, 'nbextensions': nbextensions, - 'theme': self.voila_configuration.theme + 'theme': self.voila_configuration.theme, + 'metadata': { + 'name': notebook_name + } } # include potential extra resources