The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

How to get the name of the template used to create a page?

Wikified
August 23, 2011

I'm using the Customware reporting macros to create a list of pages in a space. I'd like to be able to use the page template name as one of the column values. Is there a way to get this value?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
David Peterson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 24, 2011

There isn't really an automatic way of doing it, but there are a couple of options.

1. Parse it from the page contents.

Typically, a page has a single template, which is specified by the wiki markup of the page containing '{live-template:XXX}', where 'XXX' is the template name. You can use a regular expression to extract this name from the 'page:body' and display it. Eg:

{report-table}
  {local-reporter:page:space > space:all pages}
  {report-column:title=Page}{report-info:page:title|link=true}{report-column}
  {report-column:title=Find Template}{report-on:page:body > text:find "live-template:([^\}]+)"|separator=comma}{report-info:match:group 1}{report-on}{report-column}
{report-table}

2. Store the template name as a variable in the template itself. Eg. Add a 'Template Name' field to your template like so:

{set-data:Template Name|hidden=true|value=My Cool Template}

Then, just retrieve the 'data:Template Name' value for your column.

Hope that helps!

Regards,

David Peterson

Wikified
August 24, 2011

Perfect! Thank You

TAGS
AUG Leaders

Atlassian Community Events