-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add proxied sitemap example #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
examples/next/proxied-sitemap-apollo/example-app/src/pages/api/proxy-sitemap/[...slug].js
Show resolved
Hide resolved
...itemap-apollo/wp-env/plugins/custom-sitemap-url-adjustment/custom-sitemap-url-adjustment.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @theodesp!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great example @theodesp. I've suggested two readme changes. Also FYI, when I've built the example, Custom Sitemap URL Adjustment (MU)
was deactivated by default.
Co-authored-by: Huseyn Aghayev <[email protected]>
Co-authored-by: Huseyn Aghayev <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
This PR implements a solution for integrating WordPress XML sitemaps with a Next.js frontend. It allows WordPress sitemaps to be fetched, transformed, and proxied to a Next.js frontend. The domain replacement is handled by a custom WordPress plugin, which automatically adjusts the URLs before serving them through the Next.js application.
Reference
#48
Type of Change
✨ New feature (non-breaking change which adds functionality)
How Has This Been Tested?
The changes have been tested by:
Setting up the WordPress environment with XML sitemaps enabled and the custom plugin for replacing domain URLs.
Configuring a Next.js project to proxy and transform the sitemaps using the provided API route.
Verifying that requests for
/sitemap.xml
and specific sitemaps (e.g.,/wp-sitemap-posts-post-1.xml
) return the correctly transformed XML, with URLs pointing to the frontend domain (FRONTEND_URL
).Testing in both local development (with FRONTEND_URL set to http://localhost:3000) and a custom environment by overriding the FRONTEND_URL.