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

Simplify layouts/base #3

Open
wants to merge 1 commit into
base: feature/simplify-docs-base
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
80 changes: 22 additions & 58 deletions templates/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,27 @@
{% endif %}

{% set current_path = current_path | default(value="/") %}
{% if section and section.title %}
{% if section.path is starting_with("/learn/book/") %}
{% set page_title = "Bevy Book: " ~ section.title %}
{% elif section.path is starting_with("/learn/errors/") %}
{% set page_title = "Bevy Errors: " ~ section.title %}
{% elif section.path is starting_with("/assets") %}
{% set page_title = "Bevy Assets" %}
{% else %}
{% set page_title = section.title %}
{% endif %}
{% elif page and page.title %}
{% if page.path is starting_with("/learn/book/") %}
{% set page_title = "Bevy Book: " ~ page.title %}
{% elif page.path is starting_with("/learn/errors/") %}
{% set page_title = "Bevy Errors: " ~ page.title %}
{% elif page.path is starting_with("/assets") %}

{% if section_or_page and section_or_page.title %}
{% if section_or_page.path is starting_with("/learn/book/") %}
{% set page_title = "Bevy Book: " ~ section_or_page.title %}
{% elif section_or_page.path is starting_with("/learn/errors/") %}
{% set page_title = "Bevy Errors: " ~ section_or_page.title %}
{% elif section_or_page.path is starting_with("/assets") %}
{% set page_title = "Bevy Assets" %}
{% else %}
{% set page_title = page.title %}
{% set page_title = section_or_page.title %}
{% endif %}
{% else %}
{% set page_title = "Bevy Engine" %}
{% endif %}
{% if section and section.path %}
{% set path = "/" ~ section.path %}
{% elif page and page.path %}
{% set path = "/" ~ page.path %}

{% if section_or_page and section_or_page.path %}
{% set path = "/" ~ section_or_page.path %}
{% else %}
{% set path = "" %}
{% endif %}
{% if section %}
{% if section.path is starting_with("/learn/book/") %}
{% set show_nav_toggle = true %}
{% elif section.path is starting_with("/learn/migration-guides/") %}
{% set show_nav_toggle = true %}
{% elif section.path is starting_with("/learn/errors/") %}
{% set show_nav_toggle = true %}
{% elif section.path is starting_with("/assets/") %}
{% set show_nav_toggle = true %}
{% endif %}
{% elif page %}
{% if page.path is starting_with("/learn/book/") or page.path is starting_with("/learn/migration-guides/") or page.path is starting_with("/learn/errors/") or page.path
is starting_with("/assets/") %}
{% set show_nav_toggle = true %}
{% endif %}
{% endif %}
Comment on lines -41 to -56
Copy link
Owner Author

Choose a reason for hiding this comment

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

show_nav_toggle is not used in the codebase, so the whole thing can be removed.


{% set newline = "
" %}
<!DOCTYPE html>
Expand Down Expand Up @@ -96,25 +71,17 @@
height="130">
</a>
<div class="header__message">
{% if section and section.extra.header_message %}
{{ section.extra.header_message }}
{% elif page and page.extra.header_message %}
{{ page.extra.header_message }}
{% elif section and section.path is starting_with("/learn/book/") or page and page.path is
starting_with("/learn/book/") %}
{% if section_or_page and section_or_page.extra.header_message %}
{{ section_or_page.extra.header_message }}
{% elif section_or_page and section_or_page.path is starting_with("/learn/book/") %}
The Book
{% elif section and section.path is starting_with("/learn/quick-start/") or page and page.path is
starting_with("/learn/quick-start/") %}
{% elif section_or_page and section_or_page.path is starting_with("/learn/quick-start/") %}
Quick Start
{% elif section and section.path is starting_with("/learn/migration-guides/") or page and page.path is
starting_with("/learn/migration-guides/") %}
{% elif section_or_page and section_or_page.path is starting_with("/learn/migration-guides/") %}
Migration Guides
{% elif section and section.path is starting_with("/learn/errors/") or page and page.path is
starting_with("/learn/errors/") %}
{% elif section_or_page and section_or_page.path is starting_with("/learn/errors/") %}
Errors
{% elif section and section.path is starting_with("/news/") %}
News
{% elif page and page.path is starting_with("/news/") %}
{% elif section_or_page and section_or_page.path is starting_with("/news/") %}
News
{% else %}
Features
Expand Down Expand Up @@ -146,8 +113,7 @@
{% block mobile_page_menu %}{% endblock mobile_page_menu %}
</div>
<ul class="main-menu__menu">
{{ header_macros::header_item(name="Getting Started", path="/learn/quick-start/getting-started",
extra_class="main-menu__entry--getting-started", current_path=current_path) }}
{{ header_macros::header_item(name="Getting Started", path="/learn/quick-start/getting-started", extra_class="main-menu__entry--getting-started", current_path=current_path) }}
{{ header_macros::header_item(name="Learn", current_path=current_path) }}
{{ header_macros::header_item(name="News", current_path=current_path) }}
{{ header_macros::header_item(name="Community", current_path=current_path) }}
Expand Down Expand Up @@ -180,10 +146,8 @@
</header>
<main class="layout__content">
<div class="container">
{% if section %}
{{ public_draft::warning(section=section) }}
{% elif page %}
{{ public_draft::warning(section=page) }}
{% if section_or_page %}
{{ public_draft::warning(section=section_or_page) }}
{% endif %}
{% block content %}{% endblock content %}
</div>
Expand Down