feat(andebol): public WP login surface, auth nav, /entrar and /registar

- Nginx: proxy wp-login.php, wp-includes, wp-admin css/js/images, and
  wp-content/languages without RFC1918 allow (works with real_ip); keep
  rest of wp-admin, wp-content, wp-json restricted.
- Domain config: auth_links on andebol.net; optional DomainConfig field.
- Astro: Portuguese/English auth labels, header/footer links, redirects.
- Bridge: omit internal detail from 503 JSON (avoid leaking upstream msgs).
- Docs: deployment + domains schema for auth and membership.

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
This commit is contained in:
Artur MoreiraandPaperclip committed 2026-03-27 10:57:57 +00:00
1 parent 738f847d36
commit aff73455d0
14 files changed
+455 -112

No files matched your search

+1 -1
View File
@@ -42,7 +42,7 @@ app.setErrorHandler((err, req, reply) => {
if (is_wp_down) {
app.log.warn({ url: req.url, err: msg }, 'WP upstream unavailable');
return reply.code(503).send({ error: 'Upstream unavailable', detail: msg });
return reply.code(503).send({ error: 'Upstream unavailable' });
}
if (err.statusCode && err.statusCode < 500) {
+1
View File
@@ -14,6 +14,7 @@ export interface DomainConfig {
timezone: string;
ads_enabled: boolean;
analytics_id: string | null;
auth_links?: boolean;
}
export interface CategoryConfig {
+6 -1
View File
@@ -15,10 +15,15 @@
{ "slug": "competicoes", "label": "Competições" },
{ "slug": "resultados", "label": "Resultados" }
],
"nav_groups": [
{ "id": "cobertura", "label": "Cobertura", "slugs": ["nacional", "internacional", "selecao"] },
{ "id": "competicao", "label": "Competição", "slugs": ["clubes", "competicoes", "resultados"] }
],
"bridge_endpoint": "http://127.0.0.1:3200",
"wp_endpoint": "http://127.0.0.1:8081/wp-json",
"locale": "pt-PT",
"timezone": "Europe/Lisbon",
"ads_enabled": false,
"analytics_id": null
"analytics_id": null,
"auth_links": true
}
+71 -32
View File
@@ -42,6 +42,76 @@ server {
proxy_send_timeout 30s;
}
# --- Public WordPress login surface (before restricted wp-* blocks) ---
# Same-origin cookies for the site hostname. With real_ip enabled, RFC1918-only rules below
# would 403 public users on wp-login. Core login UI needs css/js/images and wp-includes.
location = /wp-login.php {
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
location ^~ /wp-admin/css/ {
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
location ^~ /wp-admin/images/ {
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
location ^~ /wp-admin/js/ {
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
location ^~ /wp-includes/ {
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
# Locales for wp-login (pt_PT, etc.) live under wp-content/languages.
location ^~ /wp-content/languages/ {
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
# WordPress (Docker — port from $news_wp_port, usually 8080; andebol.net → 8081) — admin + REST.
# allow/deny use $remote_addr on the CT (often the proxy hop, not the browser — see header comment).
# Do not widen `allow` or remove `deny all` without board risk acceptance.
@@ -62,22 +132,6 @@ server {
proxy_send_timeout 120s;
}
location = /wp-login.php {
allow 127.0.0.1;
allow 10.0.0.0/8;
allow 172.16.0.0/12;
allow 192.168.0.0/16;
deny all;
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
}
location ^~ /wp-content/ {
allow 127.0.0.1;
allow 10.0.0.0/8;
@@ -92,22 +146,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
}
location ^~ /wp-includes/ {
allow 127.0.0.1;
allow 10.0.0.0/8;
allow 172.16.0.0/12;
allow 192.168.0.0/16;
deny all;
proxy_pass http://127.0.0.1:$news_wp_port;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
# Block editor and plugins use the REST API from the browser (same allow list).
+3 -1
View File
@@ -91,7 +91,9 @@ server {
HTTPS/TLS is terminated at Nginx Proxy Manager (NPM), which the board configures manually.
The checked-in `deploy/nginx/newsproject.bitreport.pt.conf` proxies **`/wp-admin/`**, **`wp-login.php`**, **`/wp-content/`**, **`/wp-includes/`**, and **`/wp-json/`** to WordPress on `127.0.0.1:8080` with **`allow`** for loopback and RFC1918 source addresses **as seen by this Nginx** (`$remote_addr`). O bloco `server` define `X-Forwarded-Proto` a partir de `$http_x_forwarded_proto` (NPM) com *fallback* para `$scheme`, para o WordPress não assumir HTTP plano quando o browser usa HTTPS.
The checked-in `deploy/nginx/newsproject.bitreport.pt.conf` proxies WordPress on `127.0.0.1:$news_wp_port` (see `conf.d/99-news-platform-wp-map.conf`). **`wp-login.php`**, **`/wp-includes/`**, **`/wp-admin/css/`**, **`/wp-admin/js/`**, **`/wp-admin/images/`**, and **`/wp-content/languages/`** are **public** (no `allow`/`deny`), so browsers can load the login UI and register when `real_ip` exposes the true client IP. **`/wp-admin/`** (remainder), **`/wp-content/`** (other than `languages/`), and **`/wp-json/`** still use **`allow`** for loopback and RFC1918 **`$remote_addr`**. O bloco `server` define `X-Forwarded-Proto` a partir de `$http_x_forwarded_proto` (NPM) com *fallback* para `$scheme`, para o WordPress não assumir HTTP plano quando o browser usa HTTPS.
**Membership / registo:** in WordPress **Settings → General**, enable **Anyone can register** if the site should offer self-service signup (`/wp-login.php?action=register`, linked from the frontend as **`/registar`** when `auth_links` is true in `config/domains/<hostname>.json`).
**`wp-admin` and “public” reachability:** with **Nginx Proxy Manager** (or any reverse proxy on a private IP) in front of this CT, browsers worldwide connect to the public hostname, but the TCP client at the CT is the **proxy**. That address is usually inside `10.0.0.0/8` (or similar), so it matches `allow` — meaning **`https://…/wp-admin/` is reachable from the public Internet** through that chain, even though the config reads “RFC1918 only”. This matches operational reality; it is not a substitute for VPN-only admin unless you add controls at NPM/Cloudflare or enable **`ngx_http_realip_module`**: `set_real_ip_from` limited to **trusted** proxy IPs, `real_ip_header X-Forwarded-For`, then `allow`/`deny` apply to the restored client IP (test carefully; misconfiguration allows IP spoofing).
+8 -4
View File
@@ -88,11 +88,12 @@ A full sample lives at `config/domains/fpa-example.json`.
"locale": "pt-PT",
"timezone": "Europe/Lisbon",
"ads_enabled": false,
"analytics_id": null
"analytics_id": null,
"auth_links": true
}
```
Live file: `config/domains/andebol.net.json`. The HTML document language uses the first segment of `locale` (e.g. `pt-PT` → `<html lang="pt">` in `Base.astro`).
Live file: `config/domains/andebol.net.json`. Set **`auth_links`** to show **Entrar** / **Registar** in the header and footer and to enable **`/entrar`** → `wp-login.php` and **`/registar`** → `wp-login.php?action=register`. The HTML document language uses the first segment of `locale` (e.g. `pt-PT` → `<html lang="pt">` in `Base.astro`).
**Local smoke test:** the dev server does not read a `HOST` env var for the HTTP `Host` header. Map the hostname and open the site with that host (or send the header manually):
@@ -131,7 +132,10 @@ Shape matches `DomainConfig` in `frontend/src/types/index.ts`:
"timezone": "Europe/Lisbon",
"ads_enabled": false,
"analytics_id": null
"analytics_id": null,
// Optional: show login/register in chrome; /entrar and /registar redirect to WordPress
"auth_links": false
}
```
@@ -142,7 +146,7 @@ Shape matches `DomainConfig` in `frontend/src/types/index.ts`:
| Domain | Config file | Notes |
|--------|-------------|--------|
| `newsproject.bitreport.pt` | `newsproject.bitreport.pt.json` | `theme`: `sports` |
| `andebol.net` | `andebol.net.json` | `theme`: `institutional`; `wp_endpoint`: `:8081`; andebol news automation |
| `andebol.net` | `andebol.net.json` | `theme`: `institutional`; `wp_endpoint`: `:8081`; `auth_links`: true; andebol news automation |
| Local dev | `localhost.json` | Fallback when hostname file is missing |
---
+8
View File
@@ -0,0 +1,8 @@
import type { DomainConfig } from '../types/index.js';
export function authNavLabels(config: DomainConfig): { login: string; register: string } {
const pt = config.locale.toLowerCase().startsWith('pt');
return pt
? { login: 'Entrar', register: 'Registar' }
: { login: 'Sign in', register: 'Register' };
}
+9
View File
@@ -0,0 +1,9 @@
---
import { getDomainConfig } from '../lib/domain.js';
const config = getDomainConfig(Astro.url.hostname);
if (!config.auth_links) {
return Astro.redirect('/', 302);
}
return Astro.redirect('/wp-login.php', 302);
---
+9
View File
@@ -0,0 +1,9 @@
---
import { getDomainConfig } from '../lib/domain.js';
const config = getDomainConfig(Astro.url.hostname);
if (!config.auth_links) {
return Astro.redirect('/', 302);
}
return Astro.redirect('/wp-login.php?action=register', 302);
---
+80 -29
View File
@@ -1,23 +1,46 @@
---
import type { DomainConfig } from '../../types/index.js';
import { getUiStrings } from '../../lib/ui-i18n.js';
interface Props {
config: DomainConfig;
}
const { config } = Astro.props;
const year = new Date().getFullYear();
const ui = getUiStrings(config.locale);
---
<footer class="inst-footer" role="contentinfo">
<div class="container">
<div class="inst-footer__main">
<p class="inst-footer__name">{config.site_name}</p>
<ul class="inst-footer__legal" role="list">
<li><a href="/privacy">Privacy</a></li>
<li><a href="/terms">Terms</a></li>
<li><a href="/sitemap.xml">Sitemap</a></li>
</ul>
<div class="inst-footer__grid">
<div class="inst-footer__brand">
<a href="/" class="inst-footer__brand-link">{config.site_name}</a>
<p class="inst-footer__tagline">{config.tagline}</p>
</div>
<div class="inst-footer__col">
<h2 class="inst-footer__heading">{ui.sections_categories}</h2>
<ul class="inst-footer__links" role="list">
{config.categories.map(cat => (
<li>
<a href={`/category/${cat.slug}`}>{cat.label}</a>
</li>
))}
</ul>
</div>
<div class="inst-footer__col">
<h2 class="inst-footer__heading">{ui.info}</h2>
<ul class="inst-footer__links" role="list">
<li><a href="/privacy">{ui.privacy}</a></li>
<li><a href="/terms">{ui.terms}</a></li>
<li><a href="/sitemap.xml">{ui.sitemap}</a></li>
</ul>
</div>
</div>
<p class="inst-footer__copy">&copy; {year} {config.site_name}. All rights reserved.</p>
<p class="inst-footer__copy">
&copy; {year} {config.site_name}. {ui.all_rights_reserved}
</p>
</div>
</footer>
@@ -25,56 +48,84 @@ const year = new Date().getFullYear();
.inst-footer {
background: var(--color-accent);
border-top: 1px solid var(--color-border);
padding: var(--space-10) 0 var(--space-8);
padding: var(--space-12) 0 var(--space-8);
margin-top: var(--space-16);
}
.inst-footer__main {
display: flex;
flex-direction: column;
gap: var(--space-4);
align-items: flex-start;
.inst-footer__grid {
display: grid;
grid-template-columns: 1fr;
gap: var(--space-10);
margin-bottom: var(--space-8);
}
@media (min-width: 640px) {
.inst-footer__main {
flex-direction: row;
align-items: center;
justify-content: space-between;
.inst-footer__grid {
grid-template-columns: repeat(2, 1fr);
}
}
.inst-footer__name {
@media (min-width: 1024px) {
.inst-footer__grid {
grid-template-columns: minmax(0, 1.4fr) 1fr 1fr;
align-items: start;
}
}
.inst-footer__brand-link {
font-family: var(--font-heading, inherit);
font-size: var(--text-lg);
font-weight: 600;
color: var(--color-primary);
margin: 0;
text-decoration: none;
display: inline-block;
margin-bottom: var(--space-3);
}
.inst-footer__legal {
display: flex;
flex-wrap: wrap;
gap: var(--space-4);
.inst-footer__brand-link:hover {
text-decoration: underline;
}
.inst-footer__tagline {
margin: 0;
font-size: var(--text-sm);
line-height: 1.55;
color: var(--color-text-muted);
max-width: 28rem;
}
.inst-footer__heading {
font-size: var(--text-xs);
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--color-text-muted);
margin: 0 0 var(--space-4);
}
.inst-footer__links {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: var(--space-3);
}
.inst-footer__legal a {
.inst-footer__links a {
font-size: var(--text-sm);
color: var(--color-text-muted);
color: var(--color-text);
text-decoration: none;
transition: color 0.15s ease;
}
.inst-footer__legal a:hover {
.inst-footer__links a:hover {
color: var(--color-primary);
}
.inst-footer__copy {
margin: var(--space-8) 0 0;
padding-top: var(--space-6);
margin: 0;
padding-top: var(--space-8);
border-top: 1px solid var(--color-border);
font-size: var(--text-sm);
color: var(--color-text-muted);
+187 -39
View File
@@ -1,35 +1,115 @@
---
import type { DomainConfig } from '../../types/index.js';
import type { CategoryConfig, DomainConfig } from '../../types/index.js';
import { getUiStrings } from '../../lib/ui-i18n.js';
interface Props {
config: DomainConfig;
}
const { config } = Astro.props;
const current_path = Astro.url.pathname;
const ui = getUiStrings(config.locale);
type NavCluster = { id: string; label: string; items: CategoryConfig[] };
function resolveNavClusters(cfg: DomainConfig): NavCluster[] {
if (!cfg.nav_groups?.length) {
return [{ id: 'all', label: '', items: cfg.categories }];
}
return cfg.nav_groups
.map(g => ({
id: g.id,
label: g.label,
items: g.slugs
.map(slug => cfg.categories.find(c => c.slug === slug))
.filter((c): c is CategoryConfig => c != null),
}))
.filter(g => g.items.length > 0);
}
const nav_clusters = resolveNavClusters(config);
type MobileRow =
| { kind: 'label'; text: string }
| { kind: 'link'; slug: string; label: string };
const mobile_rows: MobileRow[] = nav_clusters.flatMap(cluster => {
const rows: MobileRow[] = [];
if (cluster.label) {
rows.push({ kind: 'label', text: cluster.label });
}
for (const cat of cluster.items) {
rows.push({ kind: 'link', slug: cat.slug, label: cat.label });
}
return rows;
});
function isCategoryActive(slug: string): boolean {
return current_path === `/category/${slug}` || current_path.startsWith(`/category/${slug}/`);
}
---
<header class="inst-header" role="banner">
<div class="inst-header__inner container">
<a href="#main-content" class="inst-header__skip">Skip to content</a>
<a href="#main-content" class="inst-header__skip">{ui.skip_to_content}</a>
<a href="/" class="inst-header__logo" aria-label={`${config.site_name} — home`}>
<a href="/" class="inst-header__logo" aria-label={`${config.site_name} — ${ui.nav_home}`}>
<span class="inst-header__logo-text">{config.site_name}</span>
</a>
<nav class="inst-header__nav" aria-label="Main navigation">
<nav class="inst-header__nav" aria-label={ui.nav_main}>
<ul class="inst-header__nav-list" role="list">
{config.categories.map(cat => (
<li>
<a
href={`/category/${cat.slug}`}
class:list={[
'inst-header__link',
{ 'inst-header__link--active': current_path === `/category/${cat.slug}` },
]}
>
{cat.label}
</a>
</li>
))}
<li class="inst-header__nav-item">
<a
href="/"
class:list={[
'inst-header__link',
{ 'inst-header__link--active': current_path === '/' },
]}
>
{ui.nav_home}
</a>
</li>
{nav_clusters.map(cluster =>
cluster.label ? (
<li class="inst-header__nav-cluster" aria-label={cluster.label}>
<span class="inst-header__nav-cluster-label" id={`nav-cluster-${cluster.id}`}>
{cluster.label}
</span>
<ul
class="inst-header__nav-cluster-list"
role="list"
aria-labelledby={`nav-cluster-${cluster.id}`}
>
{cluster.items.map(cat => (
<li>
<a
href={`/category/${cat.slug}`}
class:list={[
'inst-header__link',
{ 'inst-header__link--active': isCategoryActive(cat.slug) },
]}
>
{cat.label}
</a>
</li>
))}
</ul>
</li>
) : (
cluster.items.map(cat => (
<li class="inst-header__nav-item">
<a
href={`/category/${cat.slug}`}
class:list={[
'inst-header__link',
{ 'inst-header__link--active': isCategoryActive(cat.slug) },
]}
>
{cat.label}
</a>
</li>
))
),
)}
</ul>
</nav>
@@ -38,8 +118,8 @@ const current_path = Astro.url.pathname;
type="button"
class="inst-header__icon-btn"
data-theme-toggle
aria-label="Toggle dark/light mode"
title="Toggle theme"
aria-label={ui.toggle_theme}
title={ui.toggle_theme}
>
<svg class="inst-header__icon-sun" aria-hidden="true" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="4"/><line x1="12" y1="2" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="22"/>
@@ -55,9 +135,11 @@ const current_path = Astro.url.pathname;
<button
type="button"
class="inst-header__icon-btn inst-header__menu-btn"
aria-label="Open menu"
aria-label={ui.open_menu}
aria-expanded="false"
aria-controls="inst-mobile-menu"
data-menu-label-open={ui.open_menu}
data-menu-label-close={ui.close_menu}
>
<svg aria-hidden="true" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/>
@@ -69,7 +151,7 @@ const current_path = Astro.url.pathname;
<nav
id="inst-mobile-menu"
class="inst-header__mobile"
aria-label="Mobile navigation"
aria-label={ui.nav_mobile}
aria-hidden="true"
>
<ul class="inst-header__mobile-list" role="list">
@@ -78,22 +160,28 @@ const current_path = Astro.url.pathname;
href="/"
class:list={['inst-header__mobile-link', { 'inst-header__mobile-link--active': current_path === '/' }]}
>
Home
{ui.nav_home}
</a>
</li>
{config.categories.map(cat => (
<li>
<a
href={`/category/${cat.slug}`}
class:list={[
'inst-header__mobile-link',
{ 'inst-header__mobile-link--active': current_path === `/category/${cat.slug}` },
]}
>
{cat.label}
</a>
</li>
))}
{mobile_rows.map(row =>
row.kind === 'label' ? (
<li class="inst-header__mobile-group" role="presentation">
<span class="inst-header__mobile-group-title">{row.text}</span>
</li>
) : (
<li>
<a
href={`/category/${row.slug}`}
class:list={[
'inst-header__mobile-link',
{ 'inst-header__mobile-link--active': isCategoryActive(row.slug) },
]}
>
{row.label}
</a>
</li>
),
)}
</ul>
</nav>
</header>
@@ -106,7 +194,7 @@ const current_path = Astro.url.pathname;
background: #fff;
border-bottom: 1px solid #e2e8f0;
box-shadow: 0 1px 0 rgba(26, 58, 92, 0.06);
height: var(--header-height);
min-height: var(--header-height);
}
[data-theme="dark"] .inst-header {
@@ -118,7 +206,16 @@ const current_path = Astro.url.pathname;
display: flex;
align-items: center;
gap: var(--space-4);
height: 100%;
min-height: var(--header-height);
flex-wrap: wrap;
padding-block: var(--space-2);
}
@media (min-width: 768px) {
.inst-header__inner {
flex-wrap: nowrap;
padding-block: 0;
}
}
.inst-header__skip {
@@ -153,6 +250,7 @@ const current_path = Astro.url.pathname;
.inst-header__nav {
flex: 1;
display: none;
min-width: 0;
}
@media (min-width: 768px) {
@@ -165,6 +263,35 @@ const current_path = Astro.url.pathname;
}
.inst-header__nav-list {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-2) var(--space-4);
list-style: none;
margin: 0;
padding: 0;
}
.inst-header__nav-cluster {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-2) var(--space-3);
list-style: none;
margin: 0;
padding: 0;
}
.inst-header__nav-cluster-label {
font-size: var(--text-xs);
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--color-text-muted);
white-space: nowrap;
}
.inst-header__nav-cluster-list {
display: flex;
flex-wrap: wrap;
gap: var(--space-1);
@@ -191,7 +318,7 @@ const current_path = Astro.url.pathname;
.inst-header__link:hover,
.inst-header__link--active {
color: var(--color-primary);
background: rgba(74, 111, 165, 0.1);
background: color-mix(in srgb, var(--color-secondary) 14%, transparent);
}
.inst-header__actions {
@@ -261,6 +388,25 @@ const current_path = Astro.url.pathname;
gap: var(--space-1);
}
.inst-header__mobile-group {
list-style: none;
margin: 0;
padding: var(--space-3) 0 var(--space-1);
}
.inst-header__mobile-group:first-of-type {
padding-top: var(--space-2);
}
.inst-header__mobile-group-title {
display: block;
font-size: var(--text-xs);
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--color-text-muted);
}
.inst-header__mobile-link {
display: block;
padding: var(--space-3) var(--space-4);
@@ -282,11 +428,13 @@ const current_path = Astro.url.pathname;
<script>
const btn = document.querySelector('.inst-header__menu-btn') as HTMLButtonElement | null;
const menu = document.getElementById('inst-mobile-menu');
const labelOpen = btn?.dataset.menuLabelOpen ?? 'Open menu';
const labelClose = btn?.dataset.menuLabelClose ?? 'Close menu';
btn?.addEventListener('click', () => {
const is_open = menu?.getAttribute('aria-hidden') === 'false';
menu?.setAttribute('aria-hidden', is_open ? 'true' : 'false');
btn.setAttribute('aria-expanded', is_open ? 'false' : 'true');
btn.setAttribute('aria-label', is_open ? 'Open menu' : 'Close menu');
btn.setAttribute('aria-label', is_open ? labelOpen : labelClose);
});
</script>
+9
View File
@@ -1,11 +1,14 @@
---
import type { DomainConfig } from '../../types/index.js';
import { authNavLabels } from '../../lib/auth-labels.js';
interface Props {
config: DomainConfig;
}
const { config } = Astro.props;
const year = new Date().getFullYear();
const show_auth = config.auth_links === true;
const auth_labels = show_auth ? authNavLabels(config) : null;
---
<footer class="site-footer" role="contentinfo">
<div class="container">
@@ -30,6 +33,12 @@ const year = new Date().getFullYear();
<div class="footer-col">
<h3 class="footer-heading">Info</h3>
<ul role="list" class="footer-links">
{show_auth && auth_labels && (
<>
<li><a href="/entrar">{auth_labels.login}</a></li>
<li><a href="/registar">{auth_labels.register}</a></li>
</>
)}
<li><a href="/about">About</a></li>
<li><a href="/privacy">Privacy Policy</a></li>
<li><a href="/sitemap.xml">Sitemap</a></li>
+47
View File
@@ -1,11 +1,14 @@
---
import type { DomainConfig } from '../../types/index.js';
import { authNavLabels } from '../../lib/auth-labels.js';
interface Props {
config: DomainConfig;
}
const { config } = Astro.props;
const current_path = Astro.url.pathname;
const show_auth = config.auth_links === true;
const auth_labels = show_auth ? authNavLabels(config) : null;
---
<header class="site-header" role="banner">
<div class="header-inner container">
@@ -30,6 +33,26 @@ const current_path = Astro.url.pathname;
</a>
</li>
))}
{show_auth && auth_labels && (
<>
<li>
<a
href="/entrar"
class:list={['site-nav__link', 'site-nav__link--auth', { 'site-nav__link--active': current_path === '/entrar' }]}
>
{auth_labels.login}
</a>
</li>
<li>
<a
href="/registar"
class:list={['site-nav__link', 'site-nav__link--auth', { 'site-nav__link--active': current_path === '/registar' }]}
>
{auth_labels.register}
</a>
</li>
</>
)}
</ul>
</nav>
@@ -85,6 +108,26 @@ const current_path = Astro.url.pathname;
</a>
</li>
))}
{show_auth && auth_labels && (
<>
<li>
<a
href="/entrar"
class:list={['mobile-nav__link', { 'mobile-nav__link--active': current_path === '/entrar' }]}
>
{auth_labels.login}
</a>
</li>
<li>
<a
href="/registar"
class:list={['mobile-nav__link', { 'mobile-nav__link--active': current_path === '/registar' }]}
>
{auth_labels.register}
</a>
</li>
</>
)}
</ul>
</nav>
</header>
@@ -166,6 +209,10 @@ const current_path = Astro.url.pathname;
background: rgba(230, 57, 70, 0.07);
}
.site-nav__link--auth {
font-weight: 700;
}
.header-actions {
display: flex;
align-items: center;
+16 -5
View File
@@ -1,3 +1,15 @@
export interface CategoryConfig {
slug: string;
label: string;
}
/** Optional navigation clusters — each `slug` should match an entry in `categories`. */
export interface NavGroupConfig {
id: string;
label: string;
slugs: string[];
}
export interface DomainConfig {
site_name: string;
tagline: string;
@@ -8,17 +20,16 @@ export interface DomainConfig {
secondary_color: string;
accent_color: string;
categories: CategoryConfig[];
/** When set, primary nav is grouped; otherwise all `categories` are shown in order. */
nav_groups?: NavGroupConfig[];
bridge_endpoint: string;
wp_endpoint: string;
locale: string;
timezone: string;
ads_enabled: boolean;
analytics_id: string | null;
}
export interface CategoryConfig {
slug: string;
label: string;
/** When true, show login/register in chrome and expose /entrar + /registar → WordPress. */
auth_links?: boolean;
}
export interface Article {