Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove broken links in Sitecore

Tags:

sitecore

We've got a Sitecore site where several items have broken links to an old workflow state that is no longer with us. I know that you can remove links when you delete an item, but I'm not seeing an interface to simple remove a broken link on an item, when the missing item is already gone.

What's the best way to remove broken links in this case? Thanks.

like image 924
Scott Avatar asked Feb 25 '15 17:02

Scott


2 Answers

There is Sitecore admin page that allows removing broken links. You can find it here:

http://localhost/sitecore/admin/RemoveBrokenLinks.aspx

You just select the database and execute the action. You can also serialize all items changed during this process.

You may need to change timeout settings in web.config:

<setting name="DefaultSQLTimeout" value="10:00:00" />
<setting name="DataProviderTimeout" value="00:00:00" />
like image 96
Marek Musielak Avatar answered Sep 20 '22 11:09

Marek Musielak


Sitecore maintains a table named Links in the database specified in the LinkDatabase section of web.config. You can get all broken links in following way:

Sitecore.Data.Database db = Sitecore.Context.Database;
Sitecore.Links.LinkDatabase linkDb = Sitecore.Globals.LinkDatabase;
Sitecore.Links.ItemLink[] brokenLinks = linkDb.GetBrokenLinks(db);
like image 42
rba Avatar answered Sep 18 '22 11:09

rba