Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

How articles are handled on graduateshub.co.za

Articles are managed in a separate, headless WordPress install hosted on the subdomain articles.graduateshub.co.za. That subdomain is the CMS only. Editors log in there to write, edit, and publish posts. It does not serve any public-facing pages to readers.

The main site (www.graduateshub.co.za) is a Next.js app. It pulls posts from WordPress using the WordPress REST API (/wp-json/wp/v2/posts). We are not using WPGraphQL. Requests use standard query params like _embed (to pull featured images, authors, and categories in one call), _fields (to trim the payload on listing pages), per_page, slug, categories, and exclude.

There are two main rendering paths:

The blog index at /blog is a server-rendered page with 5-minute ISR caching. It paginates using WordPress’s X-WP-Total and X-WP-TotalPages response headers, shows the newest post as a featured card, and renders the rest in a grid.

Individual posts at /blog/[slug] are statically generated at build time for every existing slug (using generateStaticParams), with 1-hour ISR revalidation and dynamicParams enabled so posts published after deploy still render on demand. The post fetch is wrapped in React.cache so metadata generation and the page body share a single network call per request. Related posts are fetched by matching category IDs.

Cleaning the WordPress HTML

WordPress’s Gutenberg editor outputs HTML that is noisy and styled for the WordPress theme, not ours. Before rendering, every post goes through a cleanContent step that strips out the noise:

Gutenberg editor comments like

1 thought on “Hello world!”

Leave a Reply to A WordPress Commenter Cancel Reply

Your email address will not be published. Required fields are marked *

Scroll to Top