Skip to content

feat: fetch blog mappings from live admin API with static fallback#256

Open
Hale730 wants to merge 2 commits into
cloudflare:mainfrom
Hale730:hporter/wire-blog-mappings-api
Open

feat: fetch blog mappings from live admin API with static fallback#256
Hale730 wants to merge 2 commits into
cloudflare:mainfrom
Hale730:hporter/wire-blog-mappings-api

Conversation

@Hale730

@Hale730 Hale730 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

What

Updates the blog loader to fetch pillar/tag/author mappings from the
research-manage-content admin tool's API instead of the static
blog-mappings.ts file.

Why

The static blog-mappings.ts file requires a code change + PR every time
a new post needs to be categorized. The admin tool has a live D1 database
where mappings can be updated via UI, with AI auto-categorization on new posts.

How

At build time, blog.ts now tries to fetch from:
https://research-manage-blog.pcx-team.workers.dev/api/blog/mappings

The endpoint is protected by Cloudflare Access. Two env vars are required:

  • CF_ACCESS_CLIENT_ID
  • CF_ACCESS_CLIENT_SECRET

If either var is not set, or the request fails for any reason, it falls back
to the existing static blog-mappings.ts automatically — so contributors
without credentials can still build the site normally.

A .env.example has been added documenting the required vars.

What I deliberately didn't do

This PR doesn't remove blog-mappings.ts — it stays as the fallback.
It can be cleaned up later once the admin tool is fully deployed and stable.

Dependencies

The admin tool MRs need to be merged and deployed before the API path is live.
Until then, all builds will use the static fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant