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
Hello!
I'm trying to get pages with a certain tag. Here's my code :
var selection = Umbraco.ContentAtRoot().FirstOrDefault() .Children() .Where(x => x.IsVisible()) .Where(x => x.Value<string>("tags").Contains("legume"));
I don't have any error but I get no result.
Thanks :D
Hi Marc-Andre,
The x.Value<string>("tags") is the wrong part in you query. This code outputs 'System.String[]' and contains never the text 'legume' :)
x.Value<string>("tags")
The tags datatype value is not a single string, but an array of strings. Try x.Value<string[]>("tags") instead.
x.Value<string[]>("tags")
Oh god. So logic. Thanks again Corné :D
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get pagenodes with tags
Hello!
I'm trying to get pages with a certain tag. Here's my code :
I don't have any error but I get no result.
Thanks :D
Hi Marc-Andre,
The
x.Value<string>("tags")
is the wrong part in you query. This code outputs 'System.String[]' and contains never the text 'legume' :)The tags datatype value is not a single string, but an array of strings. Try
x.Value<string[]>("tags")
instead.Oh god. So logic. Thanks again Corné :D
is working on a reply...