Better page selection and title
Lonami Exo totufals@hotmail.com
Sat, 06 Feb 2021 22:32:10 +0100
2 files changed,
19 insertions(+),
4 deletions(-)
M
templates/base.html
→
templates/base.html
@@ -5,7 +5,20 @@ <meta charset="utf-8">
<meta name="description" content="Official Lonami's website"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> - <title>Lonami's Site</title> + <title> + {% block title %} + Lonami's + {% if current_path == '/'%} + Site + {% elif current_path is starting_with('/blog') %} + Blog + {% elif current_path is starting_with('/golb') %} + Golb + {% else %} + Confused + {% endif %} + {% endblock %} + </title> {% block css %} <link rel="stylesheet" type="text/css" href="/style.css"> {% endblock %}@@ -13,9 +26,9 @@ </head>
<body> <nav class="sections"> <ul> - <li><a href="/" class="selected">lonami's site</a></li> - <li><a href="/blog">blog</a></li> - <li><a href="/golb">golb</a></li> + <li><a href="/" class="{% if current_path == '/' %}selected{% endif %}">lonami's site</a></li> + <li><a href="/blog" class="{% if current_path is starting_with('/blog') %}selected{% endif %}">blog</a></li> + <li><a href="/golb" class="{% if current_path is starting_with('/golb') %}selected{% endif %}">golb</a></li> </ul> </nav> <main>
M
templates/blog-page.html
→
templates/blog-page.html
@@ -1,5 +1,7 @@
{% extends "base.html" %} +{% block title %}{{ page.title }} | Lonami's Blog{% endblock %} + {% block content %} <h1 class="title">{{ page.title }}</h1> <div class="time">