add nav, kinda
confusedbread confuseddbread@gmail.com
Thu, 05 Dec 2024 22:06:45 +0100
4 files changed,
31 insertions(+),
2 deletions(-)
M
config.toml
→
config.toml
@@ -1,5 +1,5 @@
# The URL the site will be built for -base_url = "https://katarina.is-a.dog" +base_url = "http://127.0.0.1:1111/"#"https://katarina.is-a.dog" # Whether to automatically compile all Sass files in the sass directory compile_sass = true@@ -14,3 +14,6 @@ highlight_code = false
[extra] # Put all your custom variables here +index_page="index" +nav = ["index","posts"] +menu_icons = {index = "", posts = ""}
M
sass/style.scss
→
sass/style.scss
@@ -13,7 +13,7 @@
body { font: 100% $font-stack; - background-color: theme.$base; + background-color: theme.$crust; color: theme.$text; }@@ -47,3 +47,17 @@ text-underline-offset: 2px;
text-decoration-color: theme.$mauve; } } + + +nav { + text-decoration: none; + a { + color: theme.$text; + background-color: theme.$surface1; + padding: 0.2em; + } + .active { + background-color: theme.$overlay1; + color: theme.$text; + } +}
M
templates/base.html
→
templates/base.html
@@ -8,6 +8,7 @@ <link rel="stylesheet" href="/style.css">
</head> <body> + {% include 'header.html' %} <section class="section"> <div class="container"> {% block content %} {% endblock %}
A
templates/header.html
@@ -0,0 +1,11 @@
+{% block header %} +<header> + <div id="menu"> + <nav> + {% for menuitem in config.extra.nav %} + <a href="{% if menuitem == config.extra.index_page %}{{config.base_url | safe }}{% else %}{{config.base_url | safe }}{{ menuitem }}{% endif %}" class="{% if menuitem in current_url and menuitem != '/' %}{{menuitem}} active{% elif menuitem == config.extra.index_page and current_url == config.base_url %}{{menuitem}} active{% else %}{{menuitem}}{% endif %}">{{ menuitem }}</a> + {% endfor %} + </nav> + </div> +</header> +{% endblock header %}