+ {title} +
+ {description && ( ++ {description} +
+ )} +diff --git a/website/astro.config.mjs b/website/astro.config.mjs index c2343e6820..b264877680 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -53,6 +53,8 @@ export default defineConfig({ '/solutions/per-tenant-db': '/', '/solutions/user-session-store': '/', '/solutions/workflows': '/', + // Changelog list view merged into the blog index + '/changelog': '/blog', }, prefetch: { prefetchAll: true, diff --git a/website/src/components/BlogArticle.astro b/website/src/components/BlogArticle.astro new file mode 100644 index 0000000000..5cb2456e3c --- /dev/null +++ b/website/src/components/BlogArticle.astro @@ -0,0 +1,250 @@ +--- +import { getCollection, render } from 'astro:content'; +import { getPostImage } from '@/lib/postImage'; +import { ArticleSocials } from '@/components/ArticleSocials'; +import { Prose } from '@/components/Prose'; +import { formatTimestamp } from '@/lib/formatDate'; +import { CATEGORIES } from '@/lib/article'; +import { Icon, faArrowLeft, faArrowRight } from '@rivet-gg/icons'; +import * as mdxComponents from '@/components/mdx'; + +interface Props { + // biome-ignore lint/suspicious/noExplicitAny: content collection entry + entry: any; + image?: { src: string; width: number; height: number } | null; + section: 'blog' | 'changelog'; +} + +const { entry, image, section } = Astro.props; +const { Content } = await render(entry); + +const { title, description } = entry.data as unknown as { title: string; description: string }; + +// "Read next" pulls from the same section the reader is currently in. +const readNextBase = section === 'changelog' ? '/changelog/' : '/blog/'; +const allPosts = await getCollection('posts'); +const otherArticles = allPosts + .filter( + (p) => + p.id !== entry.id && + !p.data.unpublished && + (section === 'changelog' ? p.data.category === 'changelog' : p.data.category !== 'changelog'), + ) + .sort((a, b) => b.data.published.getTime() - a.data.published.getTime()) + .slice(0, 3) + .map((post) => { + const data = post.data as unknown as { title: string }; + return { + slug: post.id.replace(/\/page$/, ''), + title: data.title, + category: { ...CATEGORIES[post.data.category], id: post.data.category }, + published: post.data.published, + image: getPostImage(post), + }; + }); +--- + +
+ {description} +
+ )} +- {article.description} -
+ +