Tags: Optimizely/Episerver

Fixing invisible broken links in Optimizely CMS!

On some websites, I find broken links in the «Link Status» report – but when I open the page in edit mode I'm unable to find the broken link. Annoying!

A screenshot from the Link Status report with one broken link

If I view the generated markup, I can't find the link there either. It's always the same internal format of ~/link/[som-guid].aspx. This evening I had enough, I was tired of always seeing the same broken links on the top of my report, and I really wanted to figure this out! What else to do if not open Microsoft SQL Management Studio?

I can find the content id of the page with the broken link as part of the link in the «Page Name» column. In my case, it was id 49. Then get all the properties with content from the database.

FROM tblContentProperty 
WHERE fkContentID = 49

This revealed that the one ContentArea that looks completely empty in edit mode had some content! It was a reference to a block that was deleted.

<div data-classid="36f4349b-8093-492b-b616-05d8964e4c89"
  data-contentname="Some old block that has been deleted">{}

Notice that the attribute data-contentguid has the same guid as the broken internal link, just different formatting.

If it's not obvious what specific property has the hidden content, please refer to the tables tblPropertyDefinition and tblPropertyDefinitionType.

So, when you have discovered what property contains the reference to the deleted content, what do you do? You could probably delete it from the database, but a safer approach would be simply adding another (not deleted) block to the same content area, publishing your changes, removing the block you just added, and then publish the page one last time. Then the reference to the deleted block will be removed too!

A screenshot showing how to re-check a single page in the link status report

The best part is that you do not have to re-run the Link validation scheduled job, simply click the icon highlighted above to re-check the current page. The broken link is gone!

That's it!