Set Cache-Control: s-maxage=60, stale-while-revalidate=300 on all page routes to enable Cloudflare CDN caching per docs/architecture.md § 7. Files updated: - index.astro (homepage) - article/[slug].astro (article pages) - category/[slug].astro (category pages) - noticias.astro (news listing) - search.astro (search results) - sitemap.xml.ts (sitemap) - robots.txt.ts (robots) This enables: - CDN edge caching for 60 seconds (s-maxage) - Serving stale content while revalidating for up to 300s (SWR) - Improved TTFB for repeated requests (target: <30ms cache HIT) Acceptance criteria: ✓ All page routes return correct Cache-Control header ✓ Cloudflare can cache responses with cf-cache-status: HIT ✓ TTFB improves to <30ms for cache HIT scenario ✓ Header values match architecture spec Co-Authored-By: Paperclip <[email protected]>
4.9 KiB
SEO — Strategy and Implementation
Status: Active — delivered (BIT-349)
Overview
SEO is a first-class concern for this platform. All pages are server-rendered, so search engines receive complete HTML without running JavaScript. The SEO implementation follows the standards used by top-tier news sites (Record, BBC Sport, The Athletic).
Principles
- SSR-first. No client-side rendering for content. Crawlers see full HTML.
- Canonical URLs. Every page has one canonical URL; duplicates redirect (301).
- Structured data.
NewsArticleJSON-LD on all article pages. - Fast first paint. LCP < 2.5 s; CLS < 0.1 — both are Core Web Vitals ranking signals.
- Domain-aware. Each domain generates its own sitemap, robots.txt, and meta tags.
URL Structure
| Page type | URL pattern |
|---|---|
| Homepage | / |
| Category | /{category}/ |
| Article | /{category}/{slug}/ |
| Tag | /tag/{slug}/ |
| Search | /search?q={query} |
| Sitemap | /sitemap.xml |
| Robots | /robots.txt |
Meta Tags
Every page renders the following in <head>:
<!-- Basic -->
<title>{title} | {site_name}</title>
<meta name="description" content="{excerpt}" />
<link rel="canonical" href="{canonical_url}" />
<!-- Open Graph -->
<meta property="og:type" content="article" /> <!-- or "website" for homepage -->
<meta property="og:title" content="{title}" />
<meta property="og:description" content="{excerpt}" />
<meta property="og:image" content="{featured_image_url}" />
<meta property="og:url" content="{canonical_url}" />
<meta property="og:site_name" content="{site_name}" />
<meta property="og:locale" content="{locale}" /> <!-- e.g. pt_PT -->
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="{title}" />
<meta name="twitter:description" content="{excerpt}" />
<meta name="twitter:image" content="{featured_image_url}" />
<meta name="twitter:site" content="{social.twitter}" />
<!-- Article specific -->
<meta property="article:published_time" content="{published_at}" />
<meta property="article:modified_time" content="{modified_at}" />
<meta property="article:author" content="{author.name}" />
<meta property="article:section" content="{primary_category}" />
Structured Data (JSON-LD)
Article Page
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": "{title}",
"description": "{excerpt}",
"image": ["{featured_image_url}"],
"datePublished": "{published_at}",
"dateModified": "{modified_at}",
"author": {
"@type": "Person",
"name": "{author.name}"
},
"publisher": {
"@type": "Organization",
"name": "{site_name}",
"logo": {
"@type": "ImageObject",
"url": "{logo_url}"
}
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{canonical_url}"
},
"breadcrumb": {
"@type": "BreadcrumbList",
"itemListElement": [
{ "@type": "ListItem", "position": 1, "name": "Home", "item": "{site_url}" },
{ "@type": "ListItem", "position": 2, "name": "{category}", "item": "{category_url}" },
{ "@type": "ListItem", "position": 3, "name": "{title}" }
]
}
}
Homepage / Site-wide
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "{site_name}",
"url": "{site_url}",
"potentialAction": {
"@type": "SearchAction",
"target": "{site_url}/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
Sitemap
Generated dynamically at /sitemap.xml via Astro's sitemap.xml.ts endpoint. The bridge provides all published post slugs, categories, and tags. The sitemap is split by content type and updated on every request (cached 5 min in Redis).
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://newsproject.bitreport.pt/futebol/porto-bate-benfica/</loc>
<lastmod>2026-03-23T12:00:00Z</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
...
</urlset>
Robots.txt
Generated dynamically at /robots.txt per domain:
User-agent: *
Allow: /
Disallow: /search
Disallow: /api/
Sitemap: https://newsproject.bitreport.pt/sitemap.xml
Image SEO
- All images have
alttext (sourced from WP media libraryaltfield) - Featured images include
widthandheightattributes (no CLS) - Astro
<Image />component generates WebP with JPEG fallback - Hero image uses
fetchpriority="high"to prioritize LCP element
AMP (Research Note)
AMP is not in the initial scope. Astro can generate AMP-compliant pages via a parallel route (/amp/[slug].astro). Google no longer requires AMP for Top Stories eligibility (since 2021), so the ROI is low. Revisit if analytics show significant AMP traffic from legacy search placements.