We've been working on a fresh site build for a few months now and I wanted to get some views on something that has been bugging me for the duration: hyperlinks.
Since neither the URL nor the Page Reference property allow you to specify any custom link text as with the Link Collection, we have been using two fields (a string link text and a Url for link destination). While cumbersome, this is the only solution we could come up with without creating a custom property, but it has one significant flaw that I've not found my way around yet: when page editing you aren't able to edit both link and text in one sidebar view, so you either provide an additional element in edit mode to attach the link EditAttributes to or you tell your editors to manage links in forms view. e.g.
<a href="@Url.PageLinkUrl(Model.Link)" title="@Html.PropertyFor(m => m.LinkText)">
<i class="icon" @Html.EditAttributes(m => m.Link)></i>
@Html.PropertyFor(m => m.LinkText)
How has everyone else been handling links with custom text? I feel like we must be missing something key.
I would suggest using a custom block type that you use as the type for your link properties. That way editors will be able to edit both values at once and you can have a simple template for it that renders the link with the custom text.
Simple but effective, thanks!