Exclude aliases from sitemap.xml

I’m getting warnings in SEMrush for a site that uses aliases to duplicate content into different categories.

Canonical URLs are set correctly with alias pages listing their source pages as canonical. However the aliases are still included in the sitemap.xml file which SEMRush (and other SEO tools) see as incorrect.

There doesn’t seem to be a way to add an ‘Exclude from Sitemap’ attribute to an alias or any other way to exlude aliases from the sitemap. Am I missing something here?

I have a vague memory of an issue from way back where the developer was asking for aliases to be included in the sitemap.

@JohntheFish I found this on github about including aliases in search results: Include page aliases in page search result by HamedDarragi · Pull Request #8021 · concretecms/concretecms · GitHub

I can see the use case for this. The SEO advice I’m finding says best practice is only to include canonical URLs in xml sitemaps. Although I cannot find anything definitive from Google.

I had an idea that there may have been a way to add an attribute to an alias but I think I am mistaken.

That should identify where to change the core back again :-).

Ideally, to create a new pull request to use a config value ‘exclude_aliases’ to switch the new behaviour off again. Maybe a better pull would be a v9 Task parameter for the sitemap task to ‘Exclude Aliases’.

Either way, including aliases will need to be the default as that is the ‘current’ core behaviour.

1 Like

Thanks @JohntheFish I’ve made an issue for this now: