Skip to content

Add native rendering support for the "project" WordPress post type - #493

Open
rejas wants to merge 1 commit into
prereleasefrom
feature/project-post-type-native-render
Open

Add native rendering support for the "project" WordPress post type#493
rejas wants to merge 1 commit into
prereleasefrom
feature/project-post-type-native-render

Conversation

@rejas

@rejas rejas commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Links to /project/{slug} (e.g. https://volksverpetzer.de/project/orgakarten, linked from the AfD Sachsen-Anhalt Faktencheck) previously always fell back to the embedded webview: WordPressAPI.getPost only ever queried the posts REST base, which never matches "project" — a separate WordPress custom post type.
  • WordPressAPI.getPost now accepts an optional postType override; [category]/[slug].tsx maps the project category segment to it via a small CUSTOM_POST_TYPES lookup (defaults to posts for everything else).
  • convertLoadProps now defaults categories to [] and the featured-image fetch is skipped when wp:featuredmedia is absent, since a custom post type isn't guaranteed to carry either.

Known limitation

The live WordPress REST API currently returns 401 rest_cannot_access for /wp-json/wp/v2/project — a security plugin only publicly allowlists posts and media, unlike project. So this change is dormant until that's addressed on the WordPress side (or a proxy is added); until then it degrades to the exact same webview fallback as before, so there's no behavior change in production yet. Follow-up tracked separately (Asana).

Test plan

  • pnpm lint:fix, pnpm check (types + spelling), pnpm test (145/145 suites) all pass
  • Added unit tests for WordPressAPI.getPost's new postType param and convertLoadProps's categories fallback
  • Added LoadArticle tests covering the category → post-type mapping and the no-featured-image path
  • End-to-end verification against real project post data blocked until the WP REST endpoint is allowlisted (see above)

🤖 Generated with Claude Code

Links to /project/{slug} (e.g. https://volksverpetzer.de/project/orgakarten)
previously always fell back to the embedded webview because WordPressAPI
only ever queried the "posts" REST base, which never matches a custom
post type. getPost() now accepts a postType override, [category]/[slug].tsx
maps the "project" category to it, and convertLoadProps defaults
categories to [] since custom post types aren't necessarily registered
with that taxonomy.

Known limitation: the live WordPress REST API currently returns 401 for
/wp-json/wp/v2/project (only "posts" and "media" are publicly allowlisted
by a security plugin), so this degrades to the same webview fallback as
before until that's addressed server-side. Follow-up tracked separately.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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