Thread tagged as: Question

Perch Page Title

Is there a simple way to show the title of the current page within the HTML navigation templates?


<perch:pages id="title" />

I'm looking for the HTML template equivalent of:

<?php perch_pages_title(); ?>

I can pass a variable into a perch_content_custom, but can't seem to pass a variable into a Nav template.

Tony Astley

Tony Astley 0 points

  • 4 years ago

If you add <perch:showall /> to your HTML you can see what's available in that template. If you don't see it, you can pass it into the template quite easily using a perch system variable.

Thanks Mathew. The show all feature is useful. Turns out the title of the page the navigation template is being called into cannot be displayed by the html nav template itself. The technique of setting a System Variable appears not to work for navigation calls either.

I've worked around it passing the whole nav into a PHP variable and using a different approach (removing the perch:before block from the nav .html template and echoing it for pages with nav instead).

Hi Tony

Have a look at Page Attributes and Layout Variables for manipulating Page level details.

Kind regards


Thanks Jon,

I needed to call it from the HTML template. The PHP versions on work from the page template itself.

I can successfully pass it through as a system variable using a perch_content_custom call. However the same method seems to fail when trying to pass a variable into a perch_pages_navigation call.

Not to worry, I have a work around I can fallback to now.

Sorry Tony - I missed the bit about you using navigation.

Doesn't <perch:pages id="pageTitle" /> work for you in the navigation template?


You might be onto something. I'd set my system Variable as 'pageTitle' which might be causing a clash. I'll look into that later and post what I find.

Cheers Jon.

You could then wrap that in a conditional, should you just want to output the current page title.


<perch:if exists="current_page"><perch:pages id="pageTitle" /></perch:if>