Add native rendering support for the "project" WordPress post type - #493
Open
rejas wants to merge 1 commit into
Open
Add native rendering support for the "project" WordPress post type#493rejas wants to merge 1 commit into
rejas wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/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.getPostonly ever queried thepostsREST base, which never matches "project" — a separate WordPress custom post type.WordPressAPI.getPostnow accepts an optionalpostTypeoverride;[category]/[slug].tsxmaps theprojectcategory segment to it via a smallCUSTOM_POST_TYPESlookup (defaults topostsfor everything else).convertLoadPropsnow defaultscategoriesto[]and the featured-image fetch is skipped whenwp:featuredmediais absent, since a custom post type isn't guaranteed to carry either.Known limitation
The live WordPress REST API currently returns
401 rest_cannot_accessfor/wp-json/wp/v2/project— a security plugin only publicly allowlistspostsandmedia, unlikeproject. 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 passWordPressAPI.getPost's newpostTypeparam andconvertLoadProps'scategoriesfallbackLoadArticletests covering the category → post-type mapping and the no-featured-image pathprojectpost data blocked until the WP REST endpoint is allowlisted (see above)🤖 Generated with Claude Code