Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christoffer 1 post 71 karma points
    Jun 11, 2017 @ 08:16
    Christoffer
    0

    CurrentPage.AncestorOrSelf(1) vs. CurrentPage.Site()

    Hi

    Can anyone explain the difference between CurrentPage.AncestorOrSelf(1) and CurrentPage.Site()?

    From my understanding AncestorOrSelf(1) checks if the node is at level 1, and if it's not it will take the ancestor that is. But how is CurrentPage.Site() different from this?

    Thanks in advance

  • Laurent Lequenne 122 posts 247 karma points
    Jun 12, 2017 @ 08:59
    Laurent Lequenne
    0

    it acts like :

     return content.AncestorOrSelf(1) 
    
  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jun 12, 2017 @ 09:00
    Alex Skrypnyk
    101

    Hi Christoffer

    CurrentPage.AncestorOrSelf(1) vs. CurrentPage.Site() are the same method, Site() was created for convenience and less letters in the code. So .Site() is more preferable method of getting root node.

    Thanks, Alex

Please Sign in or register to post replies

Write your reply to:

Draft