Today I would like to discuss regarding SEO Friendly URL issue then will discuss the resolutions.
Every project has to work on SEO (Search Engine Optimization). Particularly I would like to tell you about the URL. As per SEO recommendation, our URL should be in small letters and it should not have space in URLs.
To take care of this problem, we can write Sitecore event handler:
Create a patch file to configure this handler.
The above handler would work only if a content author is creating any page. While creating or renaming item/page, it will assign user given name to the item’s display name attribute and after that, it converts the given name into the lower case and replaces the space with the “-” (configured character).
But what if the hundreds of pages have already been created and now have to correct their URL as per the SEO guidelines. The above code will not work in this case.
At this point in time we can have few options:
- Change the page name manually. If you have hundreds of page, it is very difficult and time-consuming task. Since you are doing manual, it can be error-prone as well.
- Write a Sitecore command and configure it on the control panel. Whenever you will click on the command present on control panel it would run and will correct your URLs. But it will also take some time and have to write C# code on this.
- Write a Sitecore Powershell script for this. It’s very quick.
Especially I am very much impressed with Sitecore Powershell script. It saves our live whenever you have to perform the bulk operation on Sitecore items.
Powershell Script for replacing space from the URL and making the URL in small caps:
The above code is valid when items under given path have pages only otherwise you can add templateId in the condition with Get-ChildItem.
You can check the complete code here.
Thanks for your time. !!!:)SITECORE CLI LOGIN ERROR - /.well-known/openid-configuration: Bad Gateway
WALKTHROUGH OF ASP.NET RENDERING SDK
SETTING UP ASP.NET RENDERING SDK
DISABLE SITECORE PUBLISHING SERVICE
SETUP SITECORE PUBLISHING SERVICE
SITECORE CONNECT CONNECTOR - CONTENT HUB