posts and avif
Some checks failed
Deploy / build-deploy (push) Failing after 5m49s

This commit is contained in:
Jorijn van der Graaf 2026-08-10 01:37:26 +02:00
commit 6841623e23
17 changed files with 2306 additions and 148 deletions

View file

@ -287,8 +287,7 @@ HTTPResponse RenderPage(std::string_view target) {
if (const Demo* d = gContent.FindDemo(route.slug)) wantsWasm = d->needsWasm;
}
res.body = Views::RenderDocument(page,
Views::RenderNav(route.kind == RouteKind::LegacyBlog
? RouteKind::Posts : route.kind),
Views::RenderNav(NavKindFor(route.kind)),
Views::RenderFooter(),
wantsWasm ? gBootScripts : std::string_view{},
gCssHref);
@ -310,6 +309,15 @@ HTTPResponse ServeSitemap() {
out += Html::Escape(pr.slug).Str();
out += "</loc></url>\n";
}
// Post pages, from the same HasPage() test the "read more" links use — a
// sitemap that advertised a post without a body would be pointing crawlers
// at the 404 the dispatcher correctly returns for it.
for (const Post& po : gContent.posts) {
if (!po.HasPage()) continue;
out += " <url><loc>https://catcrafts.net/posts/";
out += Html::Escape(po.slug).Str();
out += "</loc></url>\n";
}
out += "</urlset>\n";
ApplyPageHeaders(res, "application/xml; charset=utf-8", true, false);
res.body = std::move(out);