-
Notifications
You must be signed in to change notification settings - Fork 39
Allow configuration of trailing slashes for meta and sitemap #387
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
Comments
This is probably something that should be configurable in Statamic core, so that packages like seo-pro and ssg can opt-into trailing slashes. We've thought about an implementation on the URL facade, maybe something like Related statamic/ideas#1293 |
@icemancast In the meantime, you can extend the class CustomSitemap extends Sitemap
{
public function pages(): array
{
return collect(parent::pages())
->map(fn ($page) => array_merge($page, [
'loc' => $page['loc'].'/',
]))
->all();
}
} |
Awesome thanks @jesseleite , google seems to be adding rules by the minute for everything and marketers seem to keep hitting me with something new I need to help with. |
@icemancast For sure! Fwiw, I'm not convinced trailing slashes matter. I think this is often a misunderstood SEO requirement. For example, looking at Google's guide, which references sitemaps.org, where the protocol only requires trailing slashes if your web server requires them to serve the page... That said, I still don't think it hurts to make it configurable! ❤️ |
@jesseleite thank you this helps my case too :). |
@jesseleite I did figure out the issue. So this statamic sites shoots to netlify and it compiles the static files. Netlify by default appends the forward slash which doesn't match the sitemap. So their seo program is complaining about the issue. |
@icemancast Ah good to know, that makes sense! |
A client needs the sitemap urls to have the appended slash in the url. How can I achieve this?
The text was updated successfully, but these errors were encountered: