5

Is it possible to get the absolute path to a Page in a SG?

Currently, I only get the immediate parent of the item in the DD4T output. For example:

... "StructureGroup": {"Id": "tcm:1006-1028-4", "PublicationId": "tcm:0-1006-1", "Title": "test-content" }

when what I really want is:

... "StructureGroup": {"Id": "tcm:1006-1028-4", "PublicationId": "tcm:0-1006-1", "Title": "/root/interim_folder/test-content" }

Does this require custom code?

3
  • 1
    You got JSON being retuned and it looks like its just the directory name of the SG. Can you provide some more context around what you're doing? Jun 12, 2013 at 17:50
  • You could extend the 'page' through the GetIPageObject in the PageFactory class. The path of a file is available in the default broker database so you can get to it in your JSON provider... but given the ID you show it is a SG path you require and this isn't available in the broker database (that I know of)... how are you rendering navigation? can you query the navigation source (perhaps having a SG ID attribute you can grab and just iterate up through ... or even have the full path on the nodes in the navigation JSON/XML). As Nick suggests, more context on what you want would be useful. Jun 12, 2013 at 19:33
  • Sure - I am intending to use this to maintain a natural navigable URI to an item. All my content is going to be placed in a search engine rather than exist in the Broker or on the filesystem - the idea being the URI requested on the device/browser can be used as a primary key to query the search engine for that content. However, regardless of the hierarchy is in place, DD4T serialised output only returns the immediate parent SG of the Page in question rendering it useless as it stands.
    – mpaton
    Jun 12, 2013 at 21:30

1 Answer 1

3

I would solve this by creating a TBB based on DD4T.Templates.Base.BaseComponentTemplate. In there I would find the path to the structure group and store it as metadata in the IPage object.

On the web application side, you could then read the path from the metadata of the page.

1
  • 1
    Thanks. This would be really useful baked into a future revision of DD4T!
    – mpaton
    Jun 13, 2013 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.