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

Add block to allow inserting content before main #655

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chadnorvell
Copy link

When extending Furo using a template with extends, there's currently not a way to add content within the page but before or after main. An example would be a top navigation bar that sits above the rest of the content but not over the left-side navigation bar.

This change adds a block that allows this through a template like this:

{% extends "furo/page.html" %}

{% block supermain %}
  <div class="my-custom-content">
    <h1>Hello World</h1>
  </div>
  {{ super() }}
  <div class="my-custom-content-on-the-bottom">
    <h1>Goodbye World</h1>
  </div>
{% endblock supermain %}

If you don't use templates to extend Furo, or if your templates don't define the supermain block, this change has no effect.

When extending Furo using a template with `extends`, there's currently
not a way to add content within the `page` but before or after `main`.
An example would be a top navigation bar that sits above the rest of the
content but not over the left-side navigation bar.

This change adds a block that allows this through a template like this:
```
{% extends "furo/page.html" %}

{% block supermain %}
  <div class="my-custom-content">
    <h1>Hello World</h1>
  </div>
  {{ super() }}
  <div class="my-custom-content-on-the-bottom">
    <h1>Goodbye World</h1>
  </div>
{% endblock supermain %}
```
If you don't use templates to extend Furo, or if your templates don't
define the `supermain` block, this change has no effect.
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

If you are adding a fixed top nav bar, you may need to make some CSS changes so that the top nav bar does not hide the normal Furo content. See Qiskit/qiskit_sphinx_theme#294 for an example. But, we wanted our nav to sit above the left table of contents, so maybe your setup wouldn't require this.

How we set up our:

https://github.com/Qiskit/qiskit_sphinx_theme/blob/97f2029899750629ecdb6aa80f058d1c7c9eea7e/qiskit_sphinx_theme/furo/base/page.html#L7-L13

@chadnorvell
Copy link
Author

@Eric-Arellano Our use case is similar, but we actually want to insert a nav bar above the content block, but not above the left table of contents. You can see what that looks like here. This method is how we insert that nav bar, but it relies on this PR's change, as utilized here.

@pradyunsg What can I do to help get this merged?

@AnthonyDiGirolamo
Copy link

hello Furo team! Anything we can do to help make this better?

@pradyunsg pradyunsg added the configuration Affects one or more configurable behaviours label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Affects one or more configurable behaviours
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants