fixed header_nav links to use get_url

This commit is contained in:
Speyll 2023-09-06 11:08:00 +01:00
parent 63f83cebb7
commit de633ec8f2

View file

@ -1,153 +1,149 @@
<!doctype html> <!doctype html>
<html lang="{{ lang }}"> <html lang="{{ lang }}">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible"/> <meta content="IE=edge" http-equiv="X-UA-Compatible"/>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"/> <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="robots" content="index, follow"> <meta name="robots" content="index, follow">
{% if page.title %} {% if page.title %}
{% set title = page.title %} {% set title = page.title %}
{% elif section.title %} {% elif section.title %}
{% set title = section.title %} {% set title = section.title %}
{% elif config.title %} {% elif config.title %}
{% set title = config.title %} {% set title = config.title %}
{% endif %} {% endif %}
{% if page.extra.author %} {% if page.extra.author %}
{% set author = page.extra.author %} {% set author = page.extra.author %}
{% elif section.extra.author %} {% elif section.extra.author %}
{% set author = section.extra.author %} {% set author = section.extra.author %}
{% elif config.extra.author %} {% elif config.extra.author %}
{% set author = config.extra.author %} {% set author = config.extra.author %}
{% endif %} {% endif %}
{% if page.description %} {% if page.description %}
{% set description = page.description | truncate(length=150) %} {% set description = page.description | truncate(length=150) %}
{% elif section.description %} {% elif section.description %}
{% set description = section.description | truncate(length=150) %} {% set description = section.description | truncate(length=150) %}
{% elif config.description %} {% elif config.description %}
{% set description = config.description | truncate(length=150) %} {% set description = config.description | truncate(length=150) %}
{% endif %} {% endif %}
{% if page.extra.image %} {% if page.extra.image %}
{% set image = get_url(path=page.extra.image, trailing_slash=false) %} {% set image = get_url(path=page.extra.image, trailing_slash=false) %}
{% elif section.extra.image %} {% elif section.extra.image %}
{% set image = get_url(path=section.extra.image, trailing_slash=false) %} {% set image = get_url(path=section.extra.image, trailing_slash=false) %}
{% elif config.extra.favicon %} {% elif config.extra.favicon %}
{% set image = get_url(path=config.extra.favicon, trailing_slash=false) %} {% set image = get_url(path=config.extra.favicon, trailing_slash=false) %}
{% endif %} {% endif %}
{% if page.permalink %} {% if page.permalink %}
{% set url = page.permalink %} {% set url = page.permalink %}
{% elif section.permalink %} {% elif section.permalink %}
{% set url = section.permalink %} {% set url = section.permalink %}
{% elif config.base_url %} {% elif config.base_url %}
{% set url = config.base_url %} {% set url = config.base_url %}
{% endif %} {% endif %}
{% if title %} {% if title %}
<title>{{ title }}</title> <title>{{ title }}</title>
{% endif %} {% endif %}
{% block metatags %} {% block metatags %}
{% if title %} {% if title %}
<meta name="title" content="{{ title }}"> <meta name="title" content="{{ title }}">
{% endif %} {% endif %}
{% if author %} {% if author %}
<meta name="author" content="{{ author }}"> <meta name="author" content="{{ author }}">
{% endif %} {% endif %}
{% if description %} {% if description %}
<meta name="description" content="{{ description }}"> <meta name="description" content="{{ description }}">
{% endif %} {% endif %}
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<meta property="og:url" content="{{ url | safe }}"> <meta property="og:url" content="{{ url | safe }}">
{% if title %} {% if title %}
<meta property="og:site_name" content="{{ config.title }}"> <meta property="og:site_name" content="{{ config.title }}">
{% endif %} {% endif %}
{% if title %} {% if title %}
<meta property="og:title" content="{{ title }}"> <meta property="og:title" content="{{ title }}">
{% endif %} {% endif %}
{% if description %} {% if description %}
<meta property="og:description" content="{{ description }}"> <meta property="og:description" content="{{ description }}">
{% endif %} {% endif %}
{% if image %} {% if image %}
<meta property="og:image" content="{{ image }}"> <meta property="og:image" content="{{ image }}">
{% endif %} {% endif %}
{% set twitter_card = config.extra.twitter_card | default(value=true) %} {% set twitter_card = config.extra.twitter_card | default(value=true) %}
{% if twitter_card != false %} {% if twitter_card != false %}
<meta property="twitter:card" content="summary_large_image"> <meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{{ url | safe }}"> <meta property="twitter:url" content="{{ url | safe }}">
{% if title %} {% if title %}
<meta property="twitter:title" content="{{ title }}"> <meta property="twitter:title" content="{{ title }}">
{% endif %} {% endif %}
{% if description %} {% if description %}
<meta property="twitter:description" content="{{ description }}"> <meta property="twitter:description" content="{{ description }}">
{% endif %} {% endif %}
{% if image %} {% if image %}
<meta property="twitter:image" content="{{ image }}"> <meta property="twitter:image" content="{{ image }}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<link rel="canonical" href="{{ url | safe }}"> <link rel="canonical" href="{{ url | safe }}">
{% if image %} {% if image %}
<link rel="shortcut icon" type="image/x-icon" href="{{ get_url(path=config.extra.favicon, trailing_slash=false) }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ get_url(path=config.extra.favicon, trailing_slash=false) }}">
{% endif %} {% endif %}
{% endblock metatags %} {% endblock metatags %}
{% if config.generate_feed %} {% if config.generate_feed %}
{% block feed %} {% block feed %}
<link rel="alternate" type="application/atom+xml" title="RSS" href="{{ get_url(path="atom.xml", trailing_slash=false) }}"> <link rel="alternate" type="application/atom+xml" title="RSS" href="{{ get_url(path="atom.xml", trailing_slash=false) }}">
{% endblock feed %} {% endblock feed %}
{% endif %} {% endif %}
{% block css %} {% block css %}
<link rel="stylesheet" href="{{ get_url(path='css/style.css', trailing_slash=false) | safe }}"/> <link rel="stylesheet" href="{{ get_url(path='css/style.css', trailing_slash=false) | safe }}"/>
{% endblock css %} {% endblock css %}
</head> </head>
<body> <body>
<div class="wrapper"> <div class="wrapper">
<header> <header>
{% if config.extra.header_nav %} {% if config.extra.header_nav %}
<nav class="navBar"> <nav class="navBar">
{% for nav_item in config.extra.header_nav %} {% for nav_item in config.extra.header_nav %}
{% set current_nav_item = nav_item[lang] %} {% set current_nav_item = nav_item[lang] %}
{% if current_nav_item and current_nav_item.name %} {% if current_nav_item and current_nav_item.name %}
<a href="{{ current_nav_item.url | safe }}" {% if current_nav_item.new_tab %}target="_blank" rel="noreferrer noopener"{% endif %}>{{ current_nav_item.name }}</a> <a href="{{ get_url(path=current_nav_item.url) }}" {% if current_nav_item.new_tab %}target="_blank" rel="noreferrer noopener"{% endif %}>{{ current_nav_item.name }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<div class="themeSwitch">
<div class="themeSwitch"> <button class="themeButton light" onclick="setTheme('light')" title="Light mode"></button>
<button class="themeButton light" onclick="setTheme('light')" title="Light mode"></button> <button class="themeButton dark" onclick="setTheme('dark')" title="Dark mode"></button>
<button class="themeButton dark" onclick="setTheme('dark')" title="Dark mode"></button> </div>
</div> </nav>
</nav> {% endif %}
{% endif %} <script>
const setTheme = (theme) => {
<script> document.documentElement.className = theme;
const setTheme = (theme) => { localStorage.setItem('theme', theme);
document.documentElement.className = theme; }
localStorage.setItem('theme', theme); const getTheme = () => {
} const theme = localStorage.getItem('theme');
const getTheme = () => { theme && setTheme(theme);
const theme = localStorage.getItem('theme'); }
theme && setTheme(theme); getTheme()
} </script>
getTheme() </header>
</script> <main>
</header> {% block content %}{% endblock content %}
</main>
<main> <footer>
{% block content %}{% endblock content %} {% block footer %}{% endblock footer %}
</main> <hr>
<div class=footContainer>
<footer> <div class="footLeft">
{% block footer %}{% endblock footer %} <p>Licensed under <a target="_blank" rel="noopener noreferrer" href="https://fr.wikipedia.org/wiki/Licence_MIT">MIT</a><br>
<hr> Built with <a target="_blank" rel="noopener noreferrer" href="https://www.getzola.org">Zola</a> using <a target="_blank" rel="noopener noreferrer" href="https://github.com/Speyll/anemone">anemone</a> theme &amp; <a target="_blank" rel="noopener noreferrer" href="https://github.com/Speyll/veqev">veqev</a> colors.<br>
<div class=footContainer> </p>
<div class="footLeft"> </div>
<p>Licensed under <a target="_blank" rel="noopener noreferrer" href="https://fr.wikipedia.org/wiki/Licence_MIT">MIT</a><br> <div class="footRight">
Built with <a target="_blank" rel="noopener noreferrer" href="https://www.getzola.org">Zola</a> using <a target="_blank" rel="noopener noreferrer" href="https://github.com/Speyll/anemone">anemone</a> theme &amp; <a target="_blank" rel="noopener noreferrer" href="https://github.com/Speyll/veqev">veqev</a> colors.<br> <!-- Size 46x46 -->
</p> <img class="footGif noStyle" loading="lazy" src="https://i.ibb.co/XYDpfcs/foot.gif" alt="footGif">
</div> <a class="metaData" target="_blank" rel="noopener noreferrer" href="{{ get_url(path="atom.xml", trailing_slash=false) }}" title="Subscribe via RSS for updates.">RSS</a>
<div class="footRight"> </div>
<!-- Size 46x46 --> </div>
<img class="footGif noStyle" loading="lazy" src="https://i.ibb.co/XYDpfcs/foot.gif" alt="footGif"> </footer>
<a class="metaData" target="_blank" rel="noopener noreferrer" href="{{ get_url(path="atom.xml", trailing_slash=false) }}" title="Subscribe via RSS for updates.">RSS</a> </div>
</div> </body>
</div>
</footer>
</div>
</body>
</html> </html>