Current page URL

Joel Goguen's Avatar

Joel Goguen

12 Sep, 2012 04:28 PM

I'm running Cascade 6.10.7 and I need to get the current page URL ( in a Velocity format. The asset URI alone (/path/to/page.html) would be fine as well. The format is being applied to a data definition block.

If I could get the page URL included in the XML generated from the block instead of from Velocity, that would be just as good.

  1. 1 Posted by Ryan Griffith on 13 Sep, 2012 01:53 PM

    Ryan Griffith's Avatar

    Hi Joel,

    Just want to clarify so I can make sure I am following your question:

    You have an XHTML Block that has a Data Definition applied to it (ie Structured Data Block) and the block is added to a page. You would like to access the calling page's path within a Format applied to a Template Region?

  2. 2 Posted by Joel Goguen on 13 Sep, 2012 02:21 PM

    Joel Goguen's Avatar

    That's exactly it. Ideally I'd like the full URL, but even just the path component would be sufficient.

  3. 3 Posted by Ryan Griffith on 13 Sep, 2012 03:38 PM

    Ryan Griffith's Avatar

    Joel, if you apply a Current Page Index Block (see FAQ on this page) to the Template Region, you will have access the calling page's path. For example, in your Velocity you could obtain this value by using:

    ## Reference the system-page node (ie calling page)
    #set ( $thePage = $_XPathTool.selectSingleNode($contentRoot,"//system-page") )
    ## Output the path value
    ## Output the link value, useful for cross-site

    Please let me know if you have any questions.


  4. 4 Posted by Joel Goguen on 13 Sep, 2012 04:20 PM

    Joel Goguen's Avatar

    I don't see where I can apply a Data Definition to the index block, or how I could have the script format getting access to both the data from the structured block and from the index block. The closest I've been able to come to getting what I need has been to create a Folder Index block, but it contains information for all pages in the folder of the asset it's applied to (I could probably select only the current page with a XPath query) and I can only see how to apply one single block to a format but I need the data from both blocks in the Velocity format.

    I'm afraid I'm going to need to ask for step-by-step directions. I haven't been able to get anywhere close to what I need to accomplish without using JavaScript to fake the effect. There's got to be something I'm missing, but nothing is jumping out at me.

  5. 5 Posted by Ryan Griffith on 13 Sep, 2012 05:39 PM

    Ryan Griffith's Avatar

    Joel, my apologies if my response caused confusion. Please let me know if the following steps help:

    • Edit the Data Definition the Page is using
    • Add a Block Chooser field to the Data Definition, and set the Render Content Depth option to 4 (this option is under Advanced)
    • Edit your Page, and add the XML Block that contains the your feed information to this new Block Chooser field
    • Modify the Page's Configuration (either at the Template, Page or Configuration Set level) and add a Current Page Index Block (instructions are under the FAQs) to the desired region, along with your Format

    By adding the Block Chooser and the Current Page Index Block, you are essentially including the content of the XML Block within your Page's content so you can access it within your Format.

    Please let me know if you have any questions.


  6. Ryan Griffith closed this discussion on 18 Oct, 2012 07:07 PM.

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

Keyboard shortcuts


? 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