Skip to content

Commit 964941a

Browse files
authored
Fix/nbclassic base url (#168)
* Example way to fix dashboard logo that affects NBClassic but not Notebook Notebook v6 still has the same problem if jupyter is started with `server` or `lab` * Tested with Notebookv6 and Notebook v7 Makes dashboard link point to /tree
1 parent 7e55b21 commit 964941a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

nbclassic/notebookapp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def _prepare_templates(self):
195195
base_dir, 'nbclassic/i18n'), fallback=True)
196196
self.jinja2_env.install_gettext_translations(nbui, newstyle=False)
197197
self.jinja2_env.globals.update(nbclassic_path=nbclassic_path)
198+
self.jinja2_env.globals.update(nbclassic_tree=url_path_join(self.serverapp.base_url, nbclassic_path(), "tree"))
198199

199200
def _link_jupyter_server_extension(self, serverapp):
200201
# Monkey-patch Jupyter Server's and nbclassic's static path list to include

nbclassic/templates/page.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@
138138

139139
<div id="header" role="navigation" aria-label="{% trans %}Top Menu{% endtrans %}">
140140
<div id="header-container" class="container">
141-
<div id="ipython_notebook" class="nav navbar-brand"><a href="{{default_url}}
141+
<div id="ipython_notebook" class="nav navbar-brand"><a href="
142+
{%- if nbclassic_tree|length > 0 -%}{{nbclassic_tree}}{%- else -%}{{default_url}}{%- endif -%}
142143
{%- if logged_in and token -%}?token={{token}}{%- endif -%}" title='{% trans %}dashboard{% endtrans %}'>
143144
{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %}
144145
</a></div>

0 commit comments

Comments
 (0)