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

Merge docs-section/docs-page templates into docs #1149

Merged
merged 6 commits into from
May 14, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/contributing/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Contributing"
template = "docs-section.html"
page_template = "docs-page.html"
template = "docs.html"
page_template = "docs.html"
insert_anchor_links = "right"
[extra]
status = 'hidden'
Expand Down
4 changes: 2 additions & 2 deletions content/learn/advanced-examples/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Advanced Examples"
template = "docs-section.html"
page_template = "docs-page.html"
template = "docs.html"
page_template = "docs.html"
[extra]
public_draft = 877
status = "hidden"
Expand Down
2 changes: 1 addition & 1 deletion content/learn/advanced-examples/sudoku/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Sudoku"
template = "docs-section.html"
template = "docs.html"
[extra]
weight = 2
status = "hidden"
Expand Down
2 changes: 1 addition & 1 deletion content/learn/advanced-examples/text-adventure/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Text Adventure"
template = "docs-section.html"
template = "docs.html"
[extra]
weight = 1
status = "hidden"
Expand Down
4 changes: 2 additions & 2 deletions content/learn/book/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Book"
template = "docs-section.html"
page_template = "docs-page.html"
template = "docs.html"
page_template = "docs.html"
insert_anchor_links = "right"
redirect_to = "learn/book/getting-started"
[extra]
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/assets/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Assets"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 5
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/audio/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Audio"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 7
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/development-practices/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Development Practices"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 9
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/ecs/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Entities, Components and Systems"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 2
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/game-logic/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Game Logic"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 3
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/getting-started/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Getting Started"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
# Redirect since old links, and for a time search results,
# use this link for what is now the quick start guide.
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/graphics/2d/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "2D"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 5
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/graphics/3d/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "3D"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 6
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/graphics/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Graphics"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 4
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/graphics/rendering-internals/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Rendering Internals"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 7
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/input/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Input"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 6
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/performance-optimizations/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Performance Optimizations"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 10
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/platforms/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Platforms"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 11
Expand Down
2 changes: 1 addition & 1 deletion content/learn/book/ui/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "User Interfaces"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 8
Expand Down
3 changes: 2 additions & 1 deletion content/learn/migration-guides/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
+++
title = "Migration Guides"
page_template = "docs-page.html"
template = "docs.html"
page_template = "docs.html"
redirect_to = "learn/migration-guides/introduction"
aliases = ["learn/book/migration-guides"]
insert_anchor_links = "right"
Expand Down
2 changes: 1 addition & 1 deletion content/learn/quick-start/3d-puzzle-game/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "3D Puzzle Game"
template = "docs-section.html"
template = "docs.html"
[extra]
weight = 3
public_draft = 877
Expand Down
4 changes: 2 additions & 2 deletions content/learn/quick-start/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Quick Start"
template = "docs-section.html"
page_template = "docs-page.html"
template = "docs.html"
page_template = "docs.html"
redirect_to = "/learn/quick-start/introduction"
aliases = ["/learn/book/quick-start"]
+++
2 changes: 1 addition & 1 deletion content/learn/quick-start/breakout/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Breakout"
template = "docs-section.html"
template = "docs.html"
[extra]
weight = 1
public_draft = 877
Expand Down
2 changes: 1 addition & 1 deletion content/learn/quick-start/falling-sand/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Falling Sand"
template = "docs-section.html"
template = "docs.html"
[extra]
weight = 2
public_draft = 877
Expand Down
2 changes: 1 addition & 1 deletion content/learn/quick-start/getting-started/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "Getting Started"
template = "docs-section.html"
template = "docs.html"
insert_anchor_links = "right"
[extra]
weight = 2
Expand Down
4 changes: 2 additions & 2 deletions generate-errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ pub fn write_section(output_path: &Path) -> anyhow::Result<()> {

const SECTION_CONTENT: &str = r#"+++
title = "Errors"
template = "docs-section.html"
page_template = "docs-page.html"
template = "docs.html"
page_template = "docs.html"
redirect_to = "/learn/errors/introduction"
+++
"#;
Expand Down
20 changes: 0 additions & 20 deletions templates/docs-page.html

This file was deleted.

20 changes: 0 additions & 20 deletions templates/docs-section.html

This file was deleted.

76 changes: 35 additions & 41 deletions templates/docs-base.html → templates/docs.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,48 @@
{% extends "layouts/page-with-menu.html" %}
{% import "macros/docs.html" as docs_macros %}

{% block head_extensions %}
{% set_global ancestor_is_public_draft = false %}
{% if section %}
{% for ancestor in section.ancestors %}
{% set ancestor_section = get_section(path=ancestor) %}
{% if not ancestor_is_public_draft and ancestor_section.extra and ancestor_section.extra.public_draft %}
{% set_global ancestor_is_public_draft = true %}
{% endif %}
{% endfor %}
{% if ancestor_is_public_draft or section and section.extra and section.extra.public_draft %}
<meta name="robots" content="noindex, nofollow, noarchive">
{% endif %}
{% elif page %}
{% for ancestor in page.ancestors %}
{% set ancestor_section = get_section(path=ancestor) %}
{% if not ancestor_is_public_draft and ancestor_section.extra and ancestor_section.extra.public_draft %}
{% set_global ancestor_is_public_draft = true %}
{% endif %}
{% endfor %}
{% if ancestor_is_public_draft or page and page.extra and page.extra.public_draft %}
<meta name="robots" content="noindex, nofollow, noarchive">

{% for ancestor in section_or_page.ancestors %}
{% set ancestor_section = get_section(path=ancestor) %}
{% if not ancestor_is_public_draft and ancestor_section.extra and ancestor_section.extra.public_draft %}
{% set_global ancestor_is_public_draft = true %}
{% endif %}
{% endfor %}

{% if ancestor_is_public_draft or section_or_page and section_or_page.extra and section_or_page.extra.public_draft %}
<meta name="robots" content="noindex, nofollow, noarchive">
{% endif %}

<script src="/optional-helpers.js"></script>
{% endblock head_extensions %}

{% block mobile_page_menu %}
{% if section and section.components %}
{% set root_section_path = section.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{% elif page and page.components %}
{% set root_section_path = page.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{% endif %}
{% set root_section_path = section_or_page.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{{ docs_macros::docs_menu(prefix="mobile-menu", root=get_section(path=root_section_path) ) }}
{% endblock mobile_page_menu %}

{% block page_menu %}
{% if section and section.components %}
{% set root_section_path = section.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{% elif page and page.components %}
{% set root_section_path = page.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{% endif %}
{% set root_section_path = section_or_page.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{{ docs_macros::docs_menu(prefix="page-menu", root=get_section(path=root_section_path) ) }}
{% endblock page_menu %}

{% block page_name %}
{% if section_or_page and section_or_page.path is starting_with("/learn/book/") %}
The Book
{% else %}
Migration Guides
{% endif %}
{% endblock page_name %}

{% block page_content %}
<div class="docs-page">
<div class="docs-content">
{% set is_migration_guide = current_path is starting_with("/learn/migration-guides") %}

{% if section and section.components %}
{% set root_section_path = section.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{% elif page and page.components %}
{% set root_section_path = page.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{% endif %}
{% set root_section_path = section_or_page.components | slice(end=2) | concat(with="_index.md") | join(sep="/") %}
{% set root_section = get_section(path=root_section_path) %}

{# Create an array of sections and pages in reading order #}
{% set all_pages = [] %}
{% set sections = [] %}
Expand All @@ -77,16 +68,16 @@
{% set pages_and_subsections_2 = p2.pages | concat(with=subsections_2) | sort(attribute="extra.weight") %}
{% for p3 in pages_and_subsections_2 %}
{% set_global all_pages = all_pages | concat(with=p3) %}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}

{% if is_migration_guide %}
{% set all_pages = all_pages | reverse %}
{% endif %}

{# Find prev/next pages #}
{% set prev_page = false %}
{% set next_page = false %}
Expand All @@ -111,10 +102,13 @@
{% set_global prev_page = p %}
{% endfor %}
<h1>
{% block docs_page_title %}{% endblock docs_page_title %}
{{ section_or_page.extra.long_title | default(value=section_or_page.title) }}
{% if section_or_page.extra.subtitle %}
<span class="docs-page-subtitle">{{ section_or_page.extra.subtitle }}</span>
{% endif %}
</h1>
<div class="media-content">
{% block docs_page_content %}{% endblock docs_page_content %}
{{ section_or_page.content | safe }}
</div>
<div class="docs-footer">
<nav class="docs-footer__nav">
Expand Down Expand Up @@ -143,7 +137,7 @@ <h1>
</nav>
<div class="docs-footer__edit-wrapper">
<a class="docs-footer__edit"
href="https://github.com/bevyengine/bevy-website/edit/main/content/{%- block docs_page_relative_path -%}{%- endblock docs_page_relative_path -%}">
href="https://github.com/bevyengine/bevy-website/edit/main/content/{{ section_or_page.relative_path }}">
<i class="icon icon--pencil"></i>
Improve this page
</a>
Expand Down