Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to customize page #1923

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 57 additions & 9 deletions docs/source/customizing.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,63 @@
Customizing your BinderHub deployment
=====================================

Frontend
--------

Header and Footer customization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BinderHub uses `Jinja <https://jinja.palletsprojects.com/en/stable/>`_ as template engine
to process the page template `binderhub/templates/page.html <https://github.com/jupyterhub/binderhub/blob/main/binderhub/templates/page.html>`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be helpful to also highlight the important parts of the template- is <div id="root"></div> the critical bit?

To add a custom header and footer,

1. copy ``binderhub/templates/page.html`` into ``files/custom-page.html``
2. edit ``files/custom-page.html`` to include the desired header and footer.
For example::

<body>
<header>
My Own BinderHub
</header>
<div id="root"></div>
<footer>
Powered by BinderHub
</footer>
</body>
3. add a `ConfigMap <https://kubernetes.io/docs/concepts/configuration/configmap/>`_ to your Helm configuration.
For example::

kind: ConfigMap
apiVersion: v1
metadata:
name: binderhub-template-custom
labels:
app: binder
component: etc-binderhub
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
data:
{{- (.Files.Glob "files/*").AsConfig | nindent 2 }}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is additional Helm configuration needed to mount the file in the ConfigMap into the BinderHub pod?

Banner customization
~~~~~~~~~~~~~~~~~~~~

By default BinderHub shows a banner at the top of all pages.
You can define the content of the banner by setting
the ``c.BinderHub.banner_message`` configuration option
to the raw HTML you would like to add.

About page customization
~~~~~~~~~~~~~~~~~~~~~~~~

BinderHub serves a simple about page at ``https://BINDERHOST/about``.
By default this shows the version of BinderHub you are running.
You can add additional HTML to the page by setting
the ``c.BinderHub.about_message`` configuration option
to the raw HTML you would like to add.
You can use this to display contact information
or other details about your deployment.

JupyterHub customization
------------------------

Expand Down Expand Up @@ -42,15 +99,6 @@ For example, ``BinderSpawner`` is defined under the ``00-binder`` key.
Keys are evaluated in alphanumeric order, so later keys such as
``10-binder-customisations`` can use objects defined in earlier keys.

About page customization
------------------------

BinderHub serves a simple about page at ``https://BINDERHOST/about``. By default
this shows the version of BinderHub you are running. You can add additional
HTML to the page by setting the ``c.BinderHub.about_message`` configuration
option to the raw HTML you would like to add. You can use this to display
contact information or other details about your deployment.

.. _repo-specific-config:

Custom configuration for specific repositories
Expand Down