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

fix: create a dedicated area for the prev-next buttons #1333

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
# "navbar_end": ["theme-switcher", "navbar-icon-links"],
# "navbar_persistent": ["search-button"],
# "primary_sidebar_end": ["custom-template.html", "sidebar-ethical-ads.html"],
# "article_footer_items": ["prev-next.html", "test.html", "test.html"],
# "content_footer_items": ["prev-next.html", "test.html", "test.html"],
# "article_footer_items": ["test.html", "test.html"],
# "content_footer_items": ["test.html", "test.html"],
# "footer_start": ["test.html", "test.html"],
# "secondary_sidebar_items": ["page-toc.html"], # Remove the source buttons
"switcher": {
Expand Down
10 changes: 4 additions & 6 deletions docs/user_guide/layout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Click on section titles to learn more about them and some basic layout configura
Article Footer

``article_footer_items``
``prev_next_area``

.. grid-item::
:padding: 2
Expand Down Expand Up @@ -155,8 +156,6 @@ Click on section titles to learn more about them and some basic layout configura

``content_footer_items``



.. grid-item::
:padding: 2
:outline:
Expand Down Expand Up @@ -442,22 +441,21 @@ Article Footer

Located in ``sections/footer-article.html``.

The article footer exists just below your page's article, and is primarily used for navigating between adjacent sections / pages.
By default, it has the following templates:
The article footer exists just below your page's article. By default, It does not contain anything immediately viewable to the reader, but is kept as a placeholder for custom or built-in templates.

.. code-block:: python

html_theme_options = {
# ...
"article_footer_items": ["prev-next.html"],
"article_footer_items": [],
# ...
}

Hide the previous and next buttons
----------------------------------

By default, each page of your site will have "previous" and "next" buttons
at the bottom. You can hide these buttons with the following configuration:
at the bottom displayed in the ``prev_next_area``. You can hide these buttons with the following configuration:

.. code:: python

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,17 @@
</article>
{% endblock docs_body %}
{# Article Footer #}
{% if theme_show_prev_next %}
{% if theme_article_footer_items %}
<footer class="bd-footer-article">
{% include "sections/footer-article.html" %}
</footer>
{% endif %}
{# prev-next buttons #}
{% if theme_show_prev_next %}
<footer class="prev-next-footer">
{% include "components/prev-next.html" %}
</footer>
{% endif %}
</div>
{# Secondary sidebar #}
{% block docs_toc %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% if theme_article_footer_items %}
<div class="footer-article-items footer-article__inner">
{% for item in theme_article_footer_items %}
<div class="footer-article-item">{% include item %}</div>
{% endfor %}
</div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ navbar_end = theme-switcher.html, navbar-icon-links.html
navbar_persistent = search-button.html
article_header_start = breadcrumbs.html
article_header_end =
article_footer_items = prev-next.html
article_footer_items =
content_footer_items =
primary_sidebar_end = sidebar-ethical-ads.html
footer_start = copyright.html, sphinx-version.html
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ def test_translations(sphinx_build_factory) -> None:
assert "Créé en utilisant" in str(footer)
assert "Construit avec le" in str(footer)

footer_article = index.select(".bd-footer-article")[0]
footer_article = index.select(".prev-next-footer")[0]
assert "précédent" in str(footer_article)
assert "page suivante" in str(footer_article)

Expand Down