Skip to content

Commit

Permalink
Add block to allow inserting content before main
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chad Norvell committed May 4, 2023
1 parent e7f732e commit e075738
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/furo/theme/furo/page.html
Expand Up @@ -58,6 +58,7 @@
{% endblock left_sidebar %}
</div>
</aside>
{% block supermain }
<div class="main">
<div class="content">
<div class="article-container">
Expand Down Expand Up @@ -205,5 +206,6 @@
{% endblock right_sidebar %}
</aside>
</div>
{% endblock supermain %}
</div>
{%- endblock %}

0 comments on commit e075738

Please sign in to comment.