Modifying the URL slug of a parent page in Concrete CMS shouldn't cause stress, but it's important to ensure that any child pages reflect this change to maintain proper navigation and avoid issues like broken links or pagination errors. There are two methods of changing the canonical path of a page but they are not equivalent. Let's explore:
For the two methods below, suppose you have a page at /blog
and several pages under it:
Method 1: Use the SEO panel
Locate the SEO panel of the parent page: Either select SEO from the parent page's properties panel or select SEO from the page's contextual menu in the Sitemap.
Edit the path: Modify the page's slug:
- In the example above, I'm changing the path from
/blog
to/news
.
- In the example above, I'm changing the path from
Save:
- Save the change.
- Ensure all of the child pages also use the new path:
The benefits of this method should be clear: you can update all the paths of the child pages at the some time as the parent page and maintain a consistent structure. Page list blocks will continue to work as expected if filtering on that parent page.
The drawback is that this method will break any existing links to those pages that are based on paths. This is generally not a problem from within the Concrete sites. Links that are created by selecting the linked page through the sitemap will be updated automatically, but links from other sites will now be broken. To fix this problem, you will need to go back and add the old path as an alternate, non-canonical path.
Method 2: Use the Location panel
Locate the Location panel of the parent page: Either select Location from the parent page's properties panel or select Location from the page's contextual menu in the Sitemap.
Change Canonical URL:
- Add a new path
- Set the new path to be the canonical path:
Save:
- Save the change.
- Change the canonical path of the child pages also use the new path:
Using this method, you can automatically add the new path to all of the child pages and requests to both the new and the original paths will still work.
The downside is that the canonical path of all the child pages remains the same. If you want them to use the new path as the canonical path, you will need to change that on each page. Since both paths are recognized, this might not be an urgent, or even strictly necessary, task.
Another potential problem is that the PageList block and other blocks that filter based on a parent page will not work correctly unless the canonical path of the child pages aligns with the parent page. In the screenshot below, you can see that only one of the blog entries now shows up in an adavnced page search using Parent Page as a filter. The missing page is still set to use the old path as its canonical path:
This issue may be related to this bug and thus might not be an issue in a future release.