Link validation/Broken Links

Vote:
 

We wanted to have a collection of link buttons that the editor could use; add one or more links to add to a block. Further; the editor should have the possibility to select appearence on each link separately; Primary, Secondary or TextLink.

With that I ruled out the PageLinkCollection. Instead I tried an IList<CustomLinkObject> where the CustomLinkObject looked like this:

public class CustomLinkObject
{
  public LinkItem LinkItem { get; set; }
  public LinkStyle Style { get; set; }
}

First time I did this something broke and I was not able to use this solution.

I therefor did like this:

public class CustomLinkObject
{
  public EPiServer.Url Link { get; set; }
  public string LinkText { get; set; }
  public LinkTarget Target { get; set; }
  public LinkStyle Style { get; set; }
}

This met my requirements.

However on the downside; The editor is not informed about the block/page being affected when opening the Handle expiration and archiving modal on the linked page. 

I can see that ContentArea, PageLink, PageLinkCollection and link in Xhtmlstring separately would be do that but not in an IList.

The question: Am I restricted to stated property types above to be notified on any broken links etc or is there other ways?

#319321
Mar 21, 2024 16:37
Vote:
 

I have now created a saving event that iterates through all LinkButtons on the pagetypes and blocktypes they exist; resolving contentreference (if possible) and adding to a contentArea hidden to the editor. 

This solves the problem without have to rewrite it all. No new content has to be added, but the content instances need to be resaved/republished. 

#319322
Mar 21, 2024 20:07
Vote:
 

Take a look at Geta Optimizely Genericlinks as this implements what you need.  Basically it introduces extensible versions of LinkItem and LinkItemCollection as LinkData and LinkDataCollection.  I've used this before to add icons and images to links and this could work well for your solution.  I'm not entirely sure if you'll get the notifications, but I'm having a nosey through their code.

#319524
Edited, Mar 26, 2024 10:10
Vote:
 

Yes, I came to find that solution suitable; if it werent that the site is now live and would have to re-populate that data :)

#319535
Mar 26, 2024 13:02
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.