Files
landing-app/landing/src/app/core/blog.ts
pigui fea60a168c Add a blog, built from pages
A post is a page in the panel's "Blog" category, so it is written,
translated, scheduled and reviewed like any page, and the MCP server
can publish one the same way. Nothing new in the API.

- /blog (/en/blog, /ca/blog): posts newest first, with image, date and
  excerpt.
- A post shows its date and leads back to the blog; its structured data
  is a BlogPosting.
- /blog/rss.xml?lang=xx: one feed per language, announced in <head>.
- Posts stay out of the header and the footer, which links the blog
  once there is any post instead of growing with every one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 15:45:08 +02:00

28 lines
883 B
TypeScript

/**
* The blog is not a type of its own: a post is a page in the panel's "Blog"
* category, written, translated, scheduled and reviewed like any other page,
* and reachable by the MCP server the same way.
*
* That category has to exist with this slug in every language — the API
* filters by the slug in the language asked for.
*/
import type { Locale } from './api';
import type { PublicPage } from './api.types';
export const BLOG_CATEGORY: Record<Locale, string> = {
es: 'blog',
en: 'blog',
ca: 'blog',
};
export function isBlogPost(page: PublicPage, locale: Locale): boolean {
return page.category?.slug === BLOG_CATEGORY[locale];
}
/** Newest first, whatever order they arrived in. */
export function byPublication(pages: PublicPage[]): PublicPage[] {
return [...pages].sort((a, b) =>
(b.published_at ?? '').localeCompare(a.published_at ?? ''),
);
}