From 9c0683ba26f3feb6a68f7d9f94ad0f13f9de4219 Mon Sep 17 00:00:00 2001 From: Niek Nijland Date: Thu, 30 Apr 2026 08:31:25 +0200 Subject: [PATCH] feat: blog overview page --- docs/src/pages/blog/index.astro | 207 ++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 docs/src/pages/blog/index.astro diff --git a/docs/src/pages/blog/index.astro b/docs/src/pages/blog/index.astro new file mode 100644 index 0000000..eaf236e --- /dev/null +++ b/docs/src/pages/blog/index.astro @@ -0,0 +1,207 @@ +--- +import Base from "@/layouts/Base.astro"; +import CallToAction from "@/partials/CallToAction.astro"; +import config from "@/config/config.json"; +import { dateFormat } from "@/lib/utils/dateFormat"; + +interface WordPressPost { + slug: string; + title: { rendered: string }; + modified: string; + excerpt?: { rendered?: string }; + yoast_head_json?: { + og_description?: string; + description?: string; + }; +} + +const blogBaseUrl = config.blog.base_url; +const { + site: { base_url }, +} = config; + +let posts: WordPressPost[] = []; + +try { + const res = await fetch( + `${blogBaseUrl}/wp-json/wp/v2/posts?_embed&per_page=100`, + ); + posts = (await res.json()) as WordPressPost[]; +} catch (e) { + throw new Error( + `Failed to fetch blog posts from "${blogBaseUrl}/wp-json/wp/v2/posts": ${e instanceof Error ? e.message : String(e)}`, + ); +} + +const items = posts + .map((post) => { + const yoast = post.yoast_head_json || {}; + const rawDescription = + yoast.og_description || yoast.description || post.excerpt?.rendered || ""; + const description = rawDescription.replace(/<[^>]+>/g, "").trim(); + + return { + slug: post.slug, + title: post.title.rendered, + modified: post.modified, + description, + }; + }) + .sort( + (a, b) => new Date(b.modified).getTime() - new Date(a.modified).getTime(), + ); + +const [featured, ...rest] = items; + +const seo = { + title: "Blog - RocketSim", + description: + "Tips, guides, and deep dives for iOS developers who want to move faster.", + canonical: `${base_url}/blog/`, +}; + +const structuredData = { + type: "static" as const, +}; +--- + + +
+
+
+ + Developer Resources + +

+ The RocketSim Blog +

+

+ Tips, guides, and deep dives for iOS developers who want to move + faster. +

+
+
+
+ +
+ +
+ + + + +