Access to the current page from in a Tridion component template

718 Views Asked by At

I realize this might be slightly counter intuitive... but in a compound component template, is there a convenient way to access the Page object or the TCM URI of the page being rendered? I realize the result might be null if the component template is being rendered into broker or being debugged using the template builder. But I would like to get the page id if it is available.

2

There are 2 best solutions below

0
Nickoli Roussakov On

Yes, you can create a TBB to do this. If you look on sdltridionworld.com there are Generic SDL Tridion 2011 Template Building Blocks available: https://sdltridionworld.com/community/2011_extensions/generic-2011-tbbs.aspx

In there there is a handly file called TemplateBase with a method called GetPage. You can use it to get the page in a TBB and then push the Page ID to the package.

0
Jonathan Williams On