ethercreative / seo

SEO utilities including a unique field type, sitemap & redirect manager
MIT License
269 stars 96 forks source link

Sitemap url's #340

Open kobeaerts opened 3 years ago

kobeaerts commented 3 years ago

Description

I'm hosting my craft site on multiple subdomains. cms.mywebsite.com and www.mywebsite.com

The cms website is the main url set in Craft and used to make changes to the content for the editor. These changes get pushed to a Netlify CDN at the www url.

The problem is that my sitemap contains references to the cms.mywebsite.com domain while I would like it to reference it to the www url's.

Is this possible or something we can add to this already great plugin?

alexjcollins commented 3 years ago

So are you using Blitz to push to Netlify? I would have thought if you set the DEFAULT_SITE_URL in your site config to the front end it should work - although we've only ever used the plugin with a decoupled front and back end in headless mode.

We have a project coming up where we're using Blitz to push to Cloudflare, so we may hit the same problem, and if we do, we'll implement a fix or come back to you with a solution.

kobeaerts commented 3 years ago

Hey Alex,

I'm indeed using the Blitz plugin to push to a Git repository that gets read by Netlify.

The problem is that if I set the www url as default Blitz cache will go there to warm the pages but these pages don't exist on the www domain :D

Right now I warm the cache with the cdn.website.com url and do a find and replace on those pages to change cdn to www.

Anyway, I'll wait and see if you guys run into the same problem ;)

Tam commented 3 years ago

A quick and dirty work-around would be to replace the subdomains in the SEO output:

{% apply replace('cms.', 'www.')|raw %}
    {% hook 'seo' %}
{% endapply %}
kobeaerts commented 3 years ago

@Tam that does not seem to change the urls in the sitemap itself?