1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-05-27 22:57:45 +02:00

Use internal links for validation

This commit is contained in:
mo8it 2025-05-17 21:28:25 +02:00
parent a51d6f1309
commit 54a74fd638
3 changed files with 13 additions and 7 deletions

View File

@ -16,16 +16,16 @@ logo_path = "images/happy_ferris.svg"
[[extra.menu_items]]
name = "Rustlings"
url = "/"
url = "@/_index.md"
[[extra.menu_items]]
name = "Setup"
url = "/setup"
url = "@/setup/index.md"
[[extra.menu_items]]
name = "Usage"
url = "/usage"
url = "@/usage/index.md"
[[extra.menu_items]]
name = "Community Exercises"
url = "/community-exercises"
url = "@/community-exercises/index.md"
[[extra.menu_items]]
name = "Q&A"
url = "https://github.com/rust-lang/rustlings/discussions/categories/q-a?discussions_q="

View File

@ -9,6 +9,6 @@
src="{{ get_url(path='images/panic.svg') | safe }}"
alt="">
<a class="text-2xl font-bold" href="{{ get_url(path='/') }}">Back to homepage</a>
<a class="text-2xl font-bold" href="{{ get_url(path='@/_index.md') }}">Back to homepage</a>
</div>
{% endblock %}

View File

@ -50,7 +50,7 @@
<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">
<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">
<a class="transition duration-500 hover:scale-110"
href="{{ get_url(path='/') | safe }}"
href="{{ get_url(path='@/_index.md') | safe }}"
aria-hidden="true">
<img class="w-12 h-12"
src="{{ get_url(path=config.extra.logo_path) | safe }}"
@ -59,7 +59,13 @@
<nav class="flex flex-col gap-x-6 items-center font-bold sm:flex-row">
{% for menu_item in config.extra.menu_items %}
<a class="p-1 no-underline" href="{{ menu_item.url | safe }}">{{ menu_item.name }}</a>
{%- if menu_item.url is starting_with("@") -%}
{% set_global menu_item_url = get_url(path=menu_item.url) %}
{%- else -%}
{% set_global menu_item_url = menu_item.url %}
{%- endif %}
<a class="p-1 no-underline" href="{{ menu_item_url | safe }}">{{ menu_item.name }}</a>
{% endfor %}
</nav>
</header>