diff --git a/bridge/src/lib/request-host.ts b/bridge/src/lib/request-host.ts index eee3d76..b92d735 100644 --- a/bridge/src/lib/request-host.ts +++ b/bridge/src/lib/request-host.ts @@ -2,13 +2,9 @@ import type { FastifyRequest } from 'fastify'; /** * Public site hostname for domain config + cache keys. - * SSR calls the bridge on loopback; the browser Host is forwarded via X-Site-Host. + * Resolved from the HTTP Host header (nginx preserves $host on /api/ proxy). */ export function resolve_site_host(req: FastifyRequest): string { - const raw = req.headers['x-site-host']; - if (typeof raw === 'string' && raw.trim()) { - return raw.split(':')[0].toLowerCase(); - } const hostname = req.hostname ?? 'localhost'; return hostname.replace(/:\d+$/, '').toLowerCase(); } diff --git a/config/writers/f0251a61-38e1-4a9b-8cd1-38d96a320cab.json b/config/writers/f0251a61-38e1-4a9b-8cd1-38d96a320cab.json index 08cdca2..1016cd6 100644 --- a/config/writers/f0251a61-38e1-4a9b-8cd1-38d96a320cab.json +++ b/config/writers/f0251a61-38e1-4a9b-8cd1-38d96a320cab.json @@ -4,9 +4,7 @@ "role": "AI News Writer", "domain": "andebol.net", "topics": [ - "Andebol", - "Futebol", - "Desportos" + "Andebol" ], "sources": [ { diff --git a/deploy/systemd/frontend.env.example b/deploy/systemd/frontend.env.example index b2e1dc7..d51989e 100644 --- a/deploy/systemd/frontend.env.example +++ b/deploy/systemd/frontend.env.example @@ -5,8 +5,15 @@ HOST=0.0.0.0 PORT=4321 -# Bridge API base URL (internal, from Astro server-side) +# Bridge API base URL — used by Astro SSR when BRIDGE_INTERNAL_URL is not set. BRIDGE_API_URL=http://127.0.0.1:3200 +# Domain JSON directory (SSR must resolve andebol.net vs newsproject — BIT-25555) +DOMAINS_CONFIG_PATH=/opt/news-platform/config/domains + +# Direct loopback override for bridge calls. Set this when the CT cannot resolve the +# public hostname (e.g. andebol.net) back to itself via DNS. Overrides nginx-routed calls. +BRIDGE_INTERNAL_URL=http://127.0.0.1:3200 + # Site domain (used for canonical URLs, sitemaps, etc.) SITE_URL=https://newsproject.bitreport.pt diff --git a/frontend/src/components/article/ArticleHeader.astro b/frontend/src/components/article/ArticleHeader.astro index 033f1a8..18304d6 100644 --- a/frontend/src/components/article/ArticleHeader.astro +++ b/frontend/src/components/article/ArticleHeader.astro @@ -8,36 +8,49 @@ interface Props { locale: string; /** When false, parent layout already renders a localized breadcrumb (e.g. institutional theme). */ showBreadcrumb?: boolean; + /** meta-only: skip title/excerpt (rendered in masthead/hero); full: default article header */ + variant?: 'full' | 'meta-only'; + /** Light text for hero overlay */ + theme?: 'default' | 'dark'; } -const { article, locale, showBreadcrumb = true } = Astro.props; + +const { + article, + locale, + showBreadcrumb = true, + variant = 'full', + theme = 'default', +} = Astro.props; const ui = getUiStrings(locale); +const is_meta_only = variant === 'meta-only'; +const is_dark = theme === 'dark'; --- -
- {showBreadcrumb && ( - +
+ {showBreadcrumb && !is_meta_only && ( + )} - -
- {article.category.name} - {article.tags.slice(0, 3).map(tag => ( - {tag.name} - ))} -
+ {!is_meta_only && ( + <> +
+ {article.category.name} + {article.tags.slice(0, 3).map(tag => ( + {tag.name} + ))} +
- -

{article.title}

+

{article.title}

- -

{article.excerpt}

+ {article.excerpt &&

{article.excerpt}

} + + )} -
{article.author.avatar ? ( @@ -89,6 +102,24 @@ const ui = getUiStrings(locale); margin-bottom: var(--space-6); } + .article-header--meta { + padding-bottom: 0; + border-bottom: none; + margin-bottom: 0; + gap: var(--space-3); + } + + .article-header--dark .article-header__author-name, + .article-header--dark .article-header__date, + .article-header--dark .article-header__reading { + color: rgba(255, 255, 255, 0.85); + } + + .article-header--dark .article-header__avatar--placeholder { + background: rgba(255, 255, 255, 0.2); + border: 2px solid rgba(255, 255, 255, 0.4); + } + .article-header__cats { display: flex; gap: var(--space-2); @@ -167,5 +198,23 @@ const ui = getUiStrings(locale); font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; + padding: 0.35em 0.75em; + background: var(--color-bg-secondary); + border-radius: 999px; + font-weight: 600; + } + + .article-header--dark .article-header__reading { + background: rgba(255, 255, 255, 0.12); + } + + .article-header--meta .article-header__reading { + background: transparent; + padding: 0; + } + + .article-header--dark.article-header--meta .article-header__reading { + background: rgba(255, 255, 255, 0.1); + padding: 0.35em 0.75em; } diff --git a/frontend/src/components/article/ArticleShareBar.astro b/frontend/src/components/article/ArticleShareBar.astro new file mode 100644 index 0000000..a3fcdbf --- /dev/null +++ b/frontend/src/components/article/ArticleShareBar.astro @@ -0,0 +1,143 @@ +--- +import { getUiStrings } from '../../lib/ui-i18n.js'; + +interface Props { + url: string; + title: string; + locale: string; +} + +const { url, title, locale } = Astro.props; +const ui = getUiStrings(locale); +const encoded_url = encodeURIComponent(url); +const encoded_title = encodeURIComponent(title); +--- +
+ {ui.share_heading} +
+ + + + {ui.share_twitter} + + + + {ui.share_facebook} + + + + {ui.share_whatsapp} + +
+
+ + + + diff --git a/frontend/src/components/article/ArticleSidebar.astro b/frontend/src/components/article/ArticleSidebar.astro new file mode 100644 index 0000000..86f1f71 --- /dev/null +++ b/frontend/src/components/article/ArticleSidebar.astro @@ -0,0 +1,288 @@ +--- +import type { Article, ArticleListItem, CategoryConfig } from '../../types/index.js'; +import { truncate } from '../../lib/format.js'; +import { getUiStrings } from '../../lib/ui-i18n.js'; + +interface Props { + article: Article; + trending: ArticleListItem[]; + categories: CategoryConfig[]; + locale: string; + ads_enabled?: boolean; +} + +const { article, trending, categories, locale, ads_enabled = false } = Astro.props; +const ui = getUiStrings(locale); +const filtered_trending = trending.filter(t => t.slug !== article.slug).slice(0, 5); +--- + + + diff --git a/frontend/src/components/article/RelatedArticles.astro b/frontend/src/components/article/RelatedArticles.astro index faeb383..5ac6b3c 100644 --- a/frontend/src/components/article/RelatedArticles.astro +++ b/frontend/src/components/article/RelatedArticles.astro @@ -1,6 +1,7 @@ --- import type { ArticleListItem } from '../../types/index.js'; import { getThemeComponents } from '../../lib/theme.js'; +import { relativeTime, truncate } from '../../lib/format.js'; import { getUiStrings } from '../../lib/ui-i18n.js'; interface Props { @@ -14,8 +15,51 @@ const ui = getUiStrings(locale); --- {articles.length > 0 && (