0
votes

I am trying to create a news section on my frontpage (Home) umbraco site. My idea is to keep the news content apart from the site content in a folder like this:

  • Home

    • Page2
    • Page3
  • News

    • News item 1
    • News item 2

But how can I get the news content into my (home) page, when it's not in the same folder?

Please help.

1
What version of umbraco?E.J. Brennan

1 Answers

2
votes

If you're using XSLT then you'd do this:

<xsl:for-each select="$currentPage/ancestor-or-self::root/News/NewsItem">
  <!-- do whatever here -->
</xsl:for-each>

If you're doing Razor syntax, then use:

@foreach (var newsitem in Library.NodeById(-1).Descendants("News").ChildrenAsList) {
  // Your processing/rendering code in here
}