Possible to display content page data (e.g. page_title) in the layout page?

Try this.

<h3> <%= typeof page_title !== 'undefined' ? page_title : '' %> </h3>

But that will still render the h3 tag if page_title is not present in the route.

Or you could try this if you don’t want to render the h3 tag at all if page_title is not present

<%if (typeof page_title !== 'undefined') { %>
<h3> <%= page_title %> </h3>
<% } %>

For reference Wappler uses EJS templating with Express for nodejs. So if you want to dig into these options you can have a look at.

https://ejs.co

1 Like