Skip to content

Commit 54a74fd

Browse files
committed
Use internal links for validation
1 parent a51d6f1 commit 54a74fd

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

website/config.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ logo_path = "images/happy_ferris.svg"
1616

1717
[[extra.menu_items]]
1818
name = "Rustlings"
19-
url = "/"
19+
url = "@/_index.md"
2020
[[extra.menu_items]]
2121
name = "Setup"
22-
url = "/setup"
22+
url = "@/setup/index.md"
2323
[[extra.menu_items]]
2424
name = "Usage"
25-
url = "/usage"
25+
url = "@/usage/index.md"
2626
[[extra.menu_items]]
2727
name = "Community Exercises"
28-
url = "/community-exercises"
28+
url = "@/community-exercises/index.md"
2929
[[extra.menu_items]]
3030
name = "Q&A"
3131
url = "https://github.com/rust-lang/rustlings/discussions/categories/q-a?discussions_q="

website/templates/404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ <h2>404: Page not found!</h2>
99
src="{{ get_url(path='images/panic.svg') | safe }}"
1010
alt="">
1111

12-
<a class="text-2xl font-bold" href="{{ get_url(path='/') }}">Back to homepage</a>
12+
<a class="text-2xl font-bold" href="{{ get_url(path='@/_index.md') }}">Back to homepage</a>
1313
</div>
1414
{% endblock %}

website/templates/base.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<body class="flex flex-col p-2 mx-auto min-h-screen text-lg text-white break-words bg-[#2A3439] lg:px-5 2xl:container">
5151
<header class="flex flex-col gap-x-4 items-center py-2 px-4 mb-1 bg-black/30 rounded-sm sm:flex-row sm:rounded-full">
5252
<a class="transition duration-500 hover:scale-110"
53-
href="{{ get_url(path='/') | safe }}"
53+
href="{{ get_url(path='@/_index.md') | safe }}"
5454
aria-hidden="true">
5555
<img class="w-12 h-12"
5656
src="{{ get_url(path=config.extra.logo_path) | safe }}"
@@ -59,7 +59,13 @@
5959

6060
<nav class="flex flex-col gap-x-6 items-center font-bold sm:flex-row">
6161
{% for menu_item in config.extra.menu_items %}
62-
<a class="p-1 no-underline" href="{{ menu_item.url | safe }}">{{ menu_item.name }}</a>
62+
{%- if menu_item.url is starting_with("@") -%}
63+
{% set_global menu_item_url = get_url(path=menu_item.url) %}
64+
{%- else -%}
65+
{% set_global menu_item_url = menu_item.url %}
66+
{%- endif %}
67+
68+
<a class="p-1 no-underline" href="{{ menu_item_url | safe }}">{{ menu_item.name }}</a>
6369
{% endfor %}
6470
</nav>
6571
</header>

0 commit comments

Comments
 (0)