Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I would like to build a multilingual news section where nodes are selected based on availability of a Vorto value in the title field. The goal is to display only those news items which contain text in the current language.
(MVC Razor code is new to me) I'm looking for something along the lines of:
var homePage = CurrentPage.AncestorsOrSelf(2).First();
var newsOverview = homePage.umbNewsOverviews.First();
var newsItems = newsOverview.umbNewsItems.Where(*this is where I'd like to select title items which have a Vorto value).OrderBy....
Is there a way to do this - either with this code, or perhaps an alternate approach?
Hi again Matt,
I found a solution which seems to work nicely:
IPublishedContent parent = CurrentPage.AncestorOrSelf(2).umbNewsOverviews.First();
var newsItems = parent.Children.Where(x => x.HasVortoValue("title")).OrderBy(x => x.SortOrder);
Of course I'm open to alternatives if you know of a better method.
Thanks again for sharing Vorto.
Nope, that's pretty much how I would do it so I think you've got it pretty spot on.
Good work on figuring it out yourself, I love an inquisitive mind :) #h5yr
Fantastic. Thanks Matt.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted