INSIGHT
DingRSS Fallback for WordPress Connection
Goal: Enable blog posts to load on aksara.me by fetching data from the WordPress RSS feed (/feed/) instead of the REST API, which is blocked by the host’s firewall in cloud environments.
User Review Required
NOTE
This is a fallback mechanism. The RSS feed may provide slightly less structured data (e.g., categories might be different, images less robust) than the full REST API, but it ensures content appears.
Proposed Changes
src/lib/wordpress.ts
- Install
rss-parser(or use manual XML parsing to avoid large deps if preferred, likely manual for simplicity). - Reasoning: RSS is standard XML. Javascript’s
DOMParserisn’t available in Node, so we’ll use a lightweight regex orfast-xml-parserif available, or just a simple string parsing helper since we only need basic fields (title, slug, date, content). - Plan: Use a lightweight custom parser or
fast-xml-parserif already in project. Check package.json first. If not, userss-parser. - [MODIFY] getPosts function:
- Attempt REST API fetch.
- If REST API fails OR returns empty array
[]: - Fetch
https://cms.aksara.me/feed/. - Parse XML to extract:
title,link(for slug),pubDate,content:encoded(or description). - New: Extract the first
<img>src fromcontent:encodedto use asfeatured_media_url. - Map to WPPost interface.
Verification Plan
Automated Tests
- Unit Test: Create
test-rss.js(like we did checking check-rss.js) but this time verifying the parsed output matches the WPPost structure. - Build Verification: Run
npm run buildlocally to see if it prefetches the RSS data successfully.
Manual Verification
Check: aksara.me/blog should show 2 posts (“Ding” and “Hello world”).
Live Site: Deploy to Netlify.
AN
Architect of Growth
Aksara Nkr
Digital Marketing Specialist
Helping brands navigate the complex intersection of technical architecture and performance marketing. Specialized in AIO, GEO, and high-scale SEO.