Skip to content

Commit

Permalink
Better early return for add_launch_buttons if no launch buttons (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier authored Feb 26, 2023
1 parent 282f14e commit 70e8ade
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sphinx_book_theme/header_buttons/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ def add_launch_buttons(
# If so, insert the URLs depending on the configuration
config_theme = app.config["html_theme_options"]
launch_buttons = config_theme.get("launch_buttons", {})
if not launch_buttons or not _is_notebook(app, pagename):
if (
not launch_buttons
or not _is_notebook(app, pagename)
or not any(
launch_buttons[key]
for key in ("binderhub_url", "jupyterhub_url", "thebe", "colab_url")
)
):
return

# Grab the header buttons from context as it should already exist.
Expand Down

0 comments on commit 70e8ade

Please sign in to comment.