Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

LinkItemCollection Not Rendering Url Correctly


I am having some issues when rendering urls in Views. Is there something special I need to do when rendering urls in Views and/or Masterpages.  Thanks in advance.  seems like the url rewriter is not picking it up for some reason.

Nov 03, 2012 2:19

In the MVC sample package (part of thge preview) on the start page there are several LinkItemCollections rendered in the bottom of the page. They are renderered through PropertyFor where the LinkItemCollection is passed in as argument.

Then there is a partial view for LinkItemCollection looking as:

<% foreach(var linkItem in Model ?? Enumerable.Empty<EPiServer.SpecializedProperties.LinkItem>()) %>
<% { %>
<%: Html.PageLink(linkItem)%>
<% } %>

So each linkitem is rendered through a helper method PageLink that takes an LinkItem. If you reflect that helper method you can see it uses IPermanentLinkMapper to get the corresponding ContentReference from the Guid. Then it calls PageLink overload that takes a ContentReference as parameter.

Nov 04, 2012 0:09

Thanks Johan.  It is exactly what i needed.

Nov 04, 2012 0:24
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.