docs: fix lang toggle — move to layout instead of markdown include

This commit is contained in:
2026-06-20 18:29:05 -03:00
parent d10598446e
commit 7d6d0b1584
9 changed files with 52 additions and 93 deletions
-9
View File
@@ -9,12 +9,3 @@ plugins:
relative_links:
enabled: true
collections: false
defaults:
- scope:
path: ""
values:
layout: "default"
header_pages:
- index.md
- guide.md
- faq.md
-72
View File
@@ -1,72 +0,0 @@
<style>
.lang-toggle {
position: fixed;
top: 12px;
right: 12px;
z-index: 1000;
display: flex;
gap: 2px;
background: #fff;
border: 1px solid #d0d7de;
border-radius: 6px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.lang-toggle a {
padding: 4px 10px;
font-size: 13px;
font-weight: 500;
text-decoration: none;
color: #656d76;
transition: background 0.15s, color 0.15s;
}
.lang-toggle a:hover {
background: #0969da;
color: #fff;
}
.lang-toggle a.active {
background: #0969da;
color: #fff;
pointer-events: none;
}
@media (prefers-color-scheme: dark) {
.lang-toggle {
background: #161b22;
border-color: #30363d;
}
.lang-toggle a {
color: #8b949e;
}
.lang-toggle a:hover {
background: #1f6feb;
color: #fff;
}
.lang-toggle a.active {
background: #1f6feb;
color: #fff;
}
}
</style>
<div class="lang-toggle" role="navigation" aria-label="Language switcher">
<a href="#" class="active" data-lang="en">EN</a>
<a href="#" data-lang="pt">PT</a>
</div>
<script>
(function() {
var path = window.location.pathname.replace(/\/unleash/, '') || '/';
var isPt = path.startsWith('/pt');
var enPath = path.replace(/^\/pt/, '') || '/';
var ptPath = '/pt' + (path === '/' || path === '/pt' ? '' : path.replace(/^\/pt/, '')) || '/pt/';
var links = document.querySelectorAll('.lang-toggle a');
links.forEach(function(link) {
var lang = link.getAttribute('data-lang');
var href = lang === 'en' ? '/unleash' + enPath : '/unleash' + ptPath;
href = href.replace(/\/+/g, '/');
link.href = href;
if ((lang === 'en' && !isPt) || (lang === 'pt' && isPt)) {
link.classList.add('active');
}
});
})();
</script>
+52
View File
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset="UTF-8">
{% seo %}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap" as="style" type="text/css" crossorigin>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
{% include head-custom.html %}
<style>
.lang-toggle{position:fixed;top:12px;right:12px;z-index:1000;display:flex;gap:2px;background:#fff;border:1px solid #d0d7de;border-radius:6px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.12)}.lang-toggle a{padding:4px 10px;font-size:13px;font-weight:500;text-decoration:none;color:#656d76;transition:background .15s,color .15s}.lang-toggle a:hover,.lang-toggle a.active{background:#0969da;color:#fff;pointer-events:none}.lang-toggle a.active{pointer-events:none}@media(prefers-color-scheme:dark){.lang-toggle{background:#161b22;border-color:#30363d}.lang-toggle a{color:#8b949e}.lang-toggle a:hover,.lang-toggle a.active{background:#1f6feb;color:#fff}}
</style>
</head>
<body>
<a id="skip-to-content" href="#content">Skip to the content.</a>
<header class="page-header" role="banner">
<h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
<h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>
{% if site.github.is_project_page %}
<a href="{{ site.github.repository_url }}" class="btn">View on GitHub</a>
{% endif %}
{% if site.show_downloads %}
<a href="{{ site.github.zip_url }}" class="btn">Download .zip</a>
<a href="{{ site.github.tar_url }}" class="btn">Download .tar.gz</a>
{% endif %}
</header>
<main id="content" class="main-content" role="main">
{{ content }}
<footer class="site-footer">
{% if site.github.is_project_page %}
<span class="site-footer-owner"><a href="{{ site.github.repository_url }}">{{ site.github.repository_name }}</a> is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a>.</span>
{% endif %}
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span>
</footer>
</main>
<div class="lang-toggle" role="navigation" aria-label="Language switcher">
<a href="#" class="active" data-lang="en">EN</a>
<a href="#" data-lang="pt">PT</a>
</div>
<script>
(function(){var p=window.location.pathname.replace(/\/unleash/,'')||'/';var i=p.startsWith('/pt');var e=p.replace(/^\/pt/,'')||'/';var t='/pt'+(p==='/'||p==='/pt'?'':p.replace(/^\/pt/,''))||'/pt/';document.querySelectorAll('.lang-toggle a').forEach(function(l){var n=l.getAttribute('data-lang');l.href='/unleash'+(n==='en'?e:t).replace(/\/+/g,'/');if((n==='en'&&!i)||(n==='pt'&&i))l.classList.add('active')})})();
</script>
</body>
</html>
-2
View File
@@ -138,5 +138,3 @@ Unleash checks for `/private/var/db/dslocal/nodes/Default` on the mounted volume
---
[Back to home](/) · [Architecture Guide](guide)
{% include lang-toggle.html %}
-2
View File
@@ -173,5 +173,3 @@ Core commands (`bypass`, `suppress`, `heal`) work entirely offline. Only `update
---
[Back to home](/) · [FAQ](faq)
{% include lang-toggle.html %}
-2
View File
@@ -456,5 +456,3 @@ Use `--verbose` for debug messages and `--log-file <path>` to write everything t
- [Security Policy](https://github.com/mateussiqueira/unleash/blob/main/SECURITY.md)
- [Discussions](https://github.com/mateussiqueira/unleash/discussions)
- [Report a Bug](https://github.com/mateussiqueira/unleash/issues/new?template=bug_report.md)
{% include lang-toggle.html %}
-2
View File
@@ -138,5 +138,3 @@ O Unleash verifica `/private/var/db/dslocal/nodes/Default` no volume montado. Se
---
[Voltar ao início](/) · [Guia de Arquitetura](guide)
{% include lang-toggle.html %}
-2
View File
@@ -173,5 +173,3 @@ Comandos principais (`bypass`, `suppress`, `heal`) funcionam completamente offli
---
[Voltar ao início](/) · [FAQ](faq)
{% include lang-toggle.html %}
-2
View File
@@ -435,5 +435,3 @@ Use `--verbose` para mensagens de debug e `--log-file <caminho>` para escrever t
- [Política de Segurança](https://github.com/mateussiqueira/unleash/blob/main/SECURITY.md)
- [Discussões](https://github.com/mateussiqueira/unleash/discussions)
- [Reportar Bug](https://github.com/mateussiqueira/unleash/issues/new?template=bug_report.md)
{% include lang-toggle.html %}