Replace absolute urls in post content fetched from headless WordPress with next.js

Viewed 310

Been searching for a couple of days now and haven't really found anything related to this issue. URLs in WP post/page content linking to other internal posts/pages are all absolute and when using WP as a headless CMS the domain needs to be replaced.

Gatsby for example has a plugin with a built in feature that does that automatically: https://www.gatsbyjs.com/plugins/gatsby-source-wordpress/

// Search and Replace Urls across WordPress content.
        searchAndReplaceContentUrls: {
          sourceUrl: "https://source-url.com",
          replacementUrl: "https://replacement-url.com",

Is there anything similar available in/for next.js or do you have to do it "manually"?

0 Answers
Related