Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
@inherits UmbracoViewPage<IRelatedLinks>
var linkCards = Model.LinkCards;
var linkCardsAreEnabled = Model.RelatedLinksEnabled;
if (linkCards == null || !linkCardsAreEnabled)
linkCards = Model.Parent.GetPropertyValue<IEnumerable<IPublishedContent>>("linkCards", true);
linkCardsAreEnabled = Model.Parent.GetPropertyValue<bool>("relatedLinksEnabled", true);
if (linkCards != null && linkCardsAreEnabled)
<div class="related-links">
<h3 class="decorative-heading" id="related-links">Related Links</h3>
<ul class="card-nav-list">
@foreach (var linkCard in linkCards)
var url = linkCard.GetPropertyValue<Link>("cardLink").Url;
var image = linkCard.GetPropertyValue<IPublishedContent>("cardImage");
<li class="card">
<a href="@url">
<div class="image">
<img src="@image.GetCropUrl("thumbnail")" width="280" height="144"
alt="@image.GetPropertyValue("cardImageAltText")" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment