Skip to content

Commit 599bfe5

Browse files
jyn514Joshua Nelson
authored andcommitted
Make the links prettier
1 parent 053d6e9 commit 599bfe5

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

templates/about-base.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{% extends "base.html" %}
22
{% block header %}
33
<div class="cratesfyi-package-container">
4-
<div class="container">
4+
<div class="container about">
5+
<h3 id="crate-title">Docs.rs documentation</h3>
56
<div class="pure-menu pure-menu-horizontal">
67
<ul class="pure-menu-list">
7-
<li><a href="/about">About</a></li>
8-
<li><a href="/about/badges">Badges</a></li>
9-
<li><a href="/about/builds">Builds</a></li>
10-
<li><a href="/about/metadata">Metadata</a></li>
11-
<li><a href="/about/redirections">Redirections</a></li>
8+
{{ macros::active_link(expected="index", href="/about", text="About") }}
9+
{{ macros::active_link(expected="badges", href="/about/badges", text="Badges") }}
10+
{{ macros::active_link(expected="builds", href="/about/builds", text="Builds") }}
11+
{{ macros::active_link(expected="metadata", href="/about/metadata", text="Metadata") }}
12+
{{ macros::active_link(expected="redirections", href="/about/redirections", text="Redirections") }}
1213
</ul>
1314
</div>
1415
</div>

templates/macros.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Makes the appropriate JS imports for highlighting
33
* `languages` An array of strings where each is a valid highlight.js language
44
#}
5+
{% macro active_link(expected, href, text) %}
6+
<li class="pure-menu-item">
7+
<a class="pure-menu-link {% if active_tab == expected %} pure-menu-active {% endif %}" href="{{ href }}">
8+
{{ text }}
9+
</a>
10+
</li>
11+
{% endmacro active_link %}
12+
513
{% macro highlight_js(languages) %}
614
{# Load the highlight script #}
715
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js" type="text/javascript"

0 commit comments

Comments
 (0)