initial commit
This commit is contained in:
134
templates/base.html
Normal file
134
templates/base.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
lang="{{ config.default_language | default(value="en") }}"
|
||||
data-theme="light"
|
||||
>
|
||||
<head>
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-VWE2PKJ3KL"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-VWE2PKJ3KL');
|
||||
</script>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{# -------------------------
|
||||
TITLE
|
||||
------------------------- #}
|
||||
<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>
|
||||
|
||||
{# -------------------------
|
||||
META DESCRIPTION
|
||||
------------------------- #}
|
||||
{% 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 }}">
|
||||
{% elif config.description %}
|
||||
<meta name="description" content="{{ config.description }}">
|
||||
{% endif %}
|
||||
|
||||
{# -------------------------
|
||||
OPEN GRAPH
|
||||
------------------------- #}
|
||||
<meta property="og:site_name" content="{{ config.title }}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="{{ config.title }}">
|
||||
<meta property="og:description" content="{{ config.description }}">
|
||||
<meta property="og:url" content="{{ current_url | default(value=config.base_url) }}">
|
||||
|
||||
{# Optional: add when you have one #}
|
||||
{# <meta property="og:image" content="{{ config.base_url }}/img/og-image.png"> #}
|
||||
|
||||
{# -------------------------
|
||||
TWITTER
|
||||
------------------------- #}
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="{{ config.title }}">
|
||||
<meta name="twitter:description" content="{{ config.description }}">
|
||||
|
||||
{# Optional #}
|
||||
{# <meta name="twitter:image" content="{{ config.base_url }}/img/og-image.png"> #}
|
||||
|
||||
{# -------------------------
|
||||
STRUCTURED DATA (JSON-LD)
|
||||
------------------------- #}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "SoftwareSourceCode",
|
||||
"name": "{{ config.title }}",
|
||||
"description": "{{ config.description }}",
|
||||
"url": "{{ config.base_url }}",
|
||||
"license": "https://www.gnu.org/licenses/agpl-3.0.html",
|
||||
"codeRepository": "{{ config.extra.repo_url | default(value="") }}",
|
||||
"programmingLanguage": "Go",
|
||||
"operatingSystem": "Linux"
|
||||
}
|
||||
</script>
|
||||
|
||||
{# -------------------------
|
||||
STYLES
|
||||
------------------------- #}
|
||||
<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" %}
|
||||
|
||||
{# -------------------------
|
||||
THEME TOGGLE SCRIPT
|
||||
------------------------- #}
|
||||
<script>
|
||||
(function () {
|
||||
const root = document.documentElement;
|
||||
const stored = localStorage.getItem('oc-theme');
|
||||
|
||||
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.innerText = current === 'dark' ? '☀ Light' : '🌙 Dark';
|
||||
};
|
||||
|
||||
updateLabel();
|
||||
|
||||
btn.addEventListener('click', () => {
|
||||
const next = root.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
|
||||
root.setAttribute('data-theme', next);
|
||||
localStorage.setItem('oc-theme', next);
|
||||
updateLabel();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user