feat: Support Arabic footer and header

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-06-01 16:50:58 +03:00
parent 2262ca4c9a
commit 59f8663011
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F
2 changed files with 18 additions and 7 deletions

View file

@ -1,5 +1,8 @@
<!doctype html>
<html dir="{% if section.extra.dir %}{{section.extra.dir}}{% else %}ltr{% endif %}" lang="{% if section.extra.lang %}{{section.extra.lang}}{% else %}en-US{% endif %}">
<html
dir="{% if section.extra.dir %}{{section.extra.dir}}{% elif page.extra.dir %}{{page.extra.dir}}{% else %}ltr{% endif %}"
lang="{% if section.extra.lang %}{{section.extra.lang}}{% elif page.extra.lang %}{{page.extra.lang}}{% else %}en-US{% endif %}"
>
<head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
@ -99,8 +102,13 @@
<div class="w">
<header>
{% if config.extra.header_nav %}
{% if page.extra.lang and page.extra.lang == "ar-SA" or section.extra.lang and section.extra.lang == "ar-SA" %}
{% set header_nav = config.extra.header_nav | reverse %}
{% else %}
{% set header_nav = config.extra.header_nav %}
{% endif %}
<nav>
{% for nav_item in config.extra.header_nav %}
{% for nav_item in header_nav %}
<a href="{{ nav_item.url | safe }}" {% if nav_item.new_tab %}target="_blank" rel="noreferrer noopener"{% endif %}>{{ nav_item.name }}</a>
{% endfor %}
</nav>
@ -112,9 +120,14 @@
</main>
<footer>
{% block footer %}{% endblock footer %}
{% if config.extra.footer_nav %}
{% if page.extra.lang and page.extra.lang == "ar-SA" or section.extra.lang and section.extra.lang == "ar-SA" and config.extra.ar_footer_nav %}
{% set footer_nav = config.extra.ar_footer_nav %}
{% elif config.extra.footer_nav %}
{% set footer_nav = config.extra.footer_nav %}
{% endif %}
{% if footer_nav %}
<nav>
{% for nav_item in config.extra.footer_nav %}
{% for nav_item in footer_nav %}
<a href="{{ nav_item.url | safe }}" {% if nav_item.new_tab %}target="_blank" rel="noreferrer noopener"{% endif %}>{{ nav_item.name }}</a>
{% endfor %}
</nav>

View file

@ -1,15 +1,13 @@
{% extends "base.html" %}
{% block header %}
<p><a href="..">..</a>/{{ page.slug }}</p>
<p class="post-meta"><time datetime="{{ page.date }}">{{ page.date }}</time></p>
<h1>{{ page.title }}</h1>
{% endblock header %}
{% block content %}
{% if page.toc and page.extra.add_toc %}
Table of contents
{% if page.extra.lang == "ar-SA" %}جدول المحتويات{% else %}Table of Contents{% endif %}
<ul>
{% for h1 in page.toc %}
<li>