Skip to content

Commit

Permalink
Main page footer can be overridden
Browse files Browse the repository at this point in the history
This allows the footer on the main (index) page to be replaced with custom HTML.

Related to jupyterhub/mybinder.org-deploy#2156
  • Loading branch information
manics committed Apr 23, 2022
1 parent 26df09a commit f5ed53e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions binderhub/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ def _log_level(self):
config=True,
)

main_footer_message = Unicode(
"",
help="""
Override the footer on the main page.
The value will be inserted "as is". Raw HTML is supported.
""",
config=True,
)

extra_footer_scripts = Dict(
{},
help="""
Expand Down Expand Up @@ -822,6 +832,7 @@ def initialize(self, *args, **kwargs):
"google_analytics_domain": self.google_analytics_domain,
"about_message": self.about_message,
"banner_message": self.banner_message,
"main_footer_message": self.main_footer_message,
"extra_footer_scripts": self.extra_footer_scripts,
"jinja2_env": jinja_env,
"build_memory_limit": self.build_memory_limit,
Expand Down
1 change: 1 addition & 0 deletions binderhub/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get(self):
submit=False,
google_analytics_code=self.settings["google_analytics_code"],
google_analytics_domain=self.settings["google_analytics_domain"],
main_footer_message=self.settings["main_footer_message"],
extra_footer_scripts=self.settings["extra_footer_scripts"],
repo_providers=self.settings["repo_providers"],
)
Expand Down
8 changes: 8 additions & 0 deletions binderhub/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,15 @@ <h3 class="text-center">How it works</h3>
{% endblock main %}

{% block footer %}

{% if main_footer_message %}
<div class="container">
{{ main_footer_message | safe }}
</div>
{% else %}
{{ super () }}
{% endif %}

<script type="text/javascript">
indexMain();
</script>
Expand Down
1 change: 1 addition & 0 deletions testing/local-binder-local-hub/binderhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
c.BinderHub.banner_message = (
'See <a href="https://github.com/jupyterhub/binderhub">BinderHub on GitHub</a>'
)
c.BinderHub.main_footer_message = '<div class="row text-center" style="transform:rotate(10deg);padding-top:3em;"><h3>This is a custom footer message.</h3></div>'

c.BinderHub.hub_url_local = "http://localhost:8000"

Expand Down

0 comments on commit f5ed53e

Please sign in to comment.