Integrating with Siteimprove

tarpley's Avatar

tarpley

06 Feb, 2014 05:28 PM

We are using SiteImprove - a service for finding spelling errors, broken links, etc. Its capable to deep linking into the cms so users can go directly from SiteImprove into Cascade to edit a page to correct errors. In order to do this, I need to add the page id into a meta tag.

I've tinkered all morning and googled a ton but haven't been able to get my velocity to work to pull the id. Looking at the xml output for the page, I see its in the id attribute for system-page but I'm an idiot when it comes to parsing xml with velocity.

I have a feeling its something similar to:
#set ( $pageid = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block/calling-page/system-page/id") )

Am I on the right track? Can anyone help?

btw, I know there is a another thread on this but it didn't answer my question and is closed: http://help.hannonhill.com/discussions/velocity-formats/3292-integr...

  1. 1 Posted by tarpley on 06 Feb, 2014 06:16 PM

    tarpley's Avatar

    Kept tinkering and answered my own question. Here's the velocity I came up with:

    #* this allows us to deep link to a specific page in siteimprove *#
    #set ( $pageID = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block/calling-page/system-page").getAttributeValue("id") )
    <meta name="PageID" content="$pageID" />
    

    I wired this velocity format up to a template and matched it to an index block that pulls all the page info.

    I'm sure there are more elegant ways to pull this off but since its so stinkin hard to find velocity examples and documentation, I figure this is better than nothing. Hope this helps someone.

    Jeremy

  2. Support Staff 2 Posted by Tim on 06 Feb, 2014 06:25 PM

    Tim's Avatar

    Hey Jeremy,

    Glad you were able to figure this out. You probably could have also done something like this as it is valid XPath:

    "/system-index-block/calling-page/system-page/@id"
    
    Have a good one!
  3. Tim closed this discussion on 06 Feb, 2014 06:25 PM.

  4. tarpley re-opened this discussion on 06 Feb, 2014 07:06 PM

  5. 3 Posted by tarpley on 06 Feb, 2014 07:06 PM

    tarpley's Avatar

    Awesome - didn’t know that, definitely more concise. Thanks Tim.

  6. Support Staff 4 Posted by Tim on 06 Feb, 2014 07:27 PM

    Tim's Avatar

    You bet! Take care, Jeremy.

  7. Tim closed this discussion on 06 Feb, 2014 07:27 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

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

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM