Files
website/themes/opencloud/templates/base.html
2026-01-20 19:49:41 +01:00

75 lines
2.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="{{ config.default_language | default(value="en") }}" data-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
{%- if page is defined and page.title -%}
{{ page.title }} {{ config.title }}
{%- elif section is defined and section.title -%}
{{ section.title }} {{ config.title }}
{%- else -%}
{{ config.title }}
{%- endif -%}
</title>
{# Description meta #}
{% if page is defined and page.description %}
<meta name="description" content="{{ page.description }}">
{% elif section is defined and section.description %}
<meta name="description" content="{{ section.description }}">
{% else %}
<meta name="description" content="{{ config.description | default(value="OpenCloud sovereign distributed cloud project") }}">
{% endif %}
<link rel="stylesheet" href="{{ get_url(path="main.css") }}">
</head>
<body>
{% include "partials/header.html" %}
<main class="oc-main">
{% block content %}{% endblock content %}
</main>
{% include "partials/footer.html" %}
<script>
(function () {
const root = document.documentElement;
const stored = localStorage.getItem('oc-theme');
// Default = light
if (stored === 'dark') {
root.setAttribute('data-theme', 'dark');
} else {
root.setAttribute('data-theme', 'light');
}
const btn = document.getElementById('oc-theme-toggle');
if (!btn) return;
const updateLabel = () => {
const current = root.getAttribute('data-theme') || 'light';
btn.dataset.theme = current;
if (current === 'dark') {
btn.innerText = '☀ Light';
} else {
btn.innerText = '🌙 Dark';
}
};
updateLabel();
btn.addEventListener('click', () => {
const current = root.getAttribute('data-theme') === 'dark' ? 'dark' : 'light';
const next = current === 'dark' ? 'light' : 'dark';
root.setAttribute('data-theme', next);
localStorage.setItem('oc-theme', next);
updateLabel();
});
})();
</script>
</body>
</html>