Get current folder display-name

Eric's Avatar

Eric

11 Mar, 2014 01:16 PM

I feel as if I'm missing something here so I'm hoping that someone will be able to help me out. Is it possible to get the current display-name of a folder through Velocity only with the format and page? I'm able to get the display-name of the folder by using a block along with the format but was unsure if the block was necessary.
This is the velocity I'm currently using to accomplish this with the block and format

#set($currentFolder = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block//system-folder[system-page[@current]]”))
$currentFolder.getChild("display-name")

Thanks!

  1. 1 Posted by Ryan Griffith on 11 Mar, 2014 06:43 PM

    Ryan Griffith's Avatar

    Hi Eric,

    If you wanted to ditch the Index Block, you should be able to accomplish this using the Locator Tool along with the $currentPagePath variable:

    #set ( $currentPage = $_.locatePage($currentPagePath) )
    #set ( $parentFolder = $_.locateFolder($currentPage.parentFolderIdentifier.path.pathAsString) )
    
    $parentFolder.metadata.displayName
    

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by Eric on 11 Mar, 2014 07:00 PM

    Eric's Avatar

    That's exactly what I was looking for, thanks!

  3. 3 Posted by Ryan Griffith on 11 Mar, 2014 08:21 PM

    Ryan Griffith's Avatar

    Not a problem at all, Eric. I am glad to hear that did the trick.

    Have a great day!

  4. Ryan Griffith closed this discussion on 11 Mar, 2014 08:21 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac