APIs & Integrations

darrengates
Mitglied

HubL variable to determine if a page is a website page or a landing page

lösung
Is there a HubL variable that allows me to determine whether a page is a "website" page or a "landing" page or "blog" page? For example:
 
this page is of type = {{page_type}}
 
the output would be something like:
 
this page is of type = landing_page
 
The reason for this is I'm hoping to use a single header partial for both, so that I don't have to update css and page structure twice when design gets updated.
0 Upvotes
1 Akzeptierte Lösung
darrengates
Lösung
Mitglied

HubL variable to determine if a page is a website page or a landing page

lösung

It looks like the answer is:

{% set pageType = content.CMSContentType %}

Lösung in ursprünglichem Beitrag anzeigen

2 Antworten
darrengates
Mitglied

HubL variable to determine if a page is a website page or a landing page

lösung

Follow up: I discovered that if I do the following in a template, it shows me a large string containing "CMSContentType=Optional[LANDING_PAGE]" 

 

I'm thinking that if I can stringify the "content" variable, and do a simple string search for the above substring, that might be one way to do this. 

 

Question is: how do I stringify an object in HubL, and also how do I search that string for a substring?

0 Upvotes
darrengates
Lösung
Mitglied

HubL variable to determine if a page is a website page or a landing page

lösung

It looks like the answer is:

{% set pageType = content.CMSContentType %}