How to remove broken links in Sitecore

让人想犯罪 __ 提交于 2019-12-04 11:08:04

问题


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.


回答1:


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" />



回答2:


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);


来源:https://stackoverflow.com/questions/28725537/how-to-remove-broken-links-in-sitecore

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!