Skip to content

Instantly share code, notes, and snippets.

@samandmoore
Created March 26, 2012 23:52
Show Gist options
  • Save samandmoore/2210797 to your computer and use it in GitHub Desktop.
Save samandmoore/2210797 to your computer and use it in GitHub Desktop.
@if (DynamicModel.AncestorsOrSelf.Where("metaNoegleord != @0", "null").Any()) {
<meta name="Keywords" content="@DynamicModel.AncestorsOrSelf.Where("metaNoegleord != @0", "null").First().metaNoegleord" />
}
@warrenbuckley
Copy link

Hiya,
Saw your tweet but not exactly sure what you are trying to do here.
Let me know and then I can give you a hand.

Warren :)

@samandmoore
Copy link
Author

Hey Warren,

Thanks. I was trying to help this guy on Jabbr yesterday and it surfaced this problem. I think essentially what im trying to do here is get a recursive property for metaNoegleord. If the does not exist on the current item then find the first ancestor that has it and display that value.

Can you help?

@warrenbuckley
Copy link

Hi
I wanted to check you was trying to do a recursive property.
It's a simple as this
@DynamicModel._metaNoegleord

@* Get the "siteName" property recursively (if not present on current page, traverse  through page ancestors, 
Notice this matches alias casing, but prefixes a _ char *@
@DynamicModel._siteName

@*OR, use Umbraco.Field*@
@Umbraco.Field("bodyText", recursive:True)

@samandmoore
Copy link
Author

aha! thanks a bunch, Warren!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment