APIs & Integrations

darrengates
Membro

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

resolver
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 Avaliação positiva
1 Solução aceita
darrengates
Solução
Membro

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

resolver

It looks like the answer is:

{% set pageType = content.CMSContentType %}

Exibir solução no post original

2 Respostas 2
darrengates
Membro

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

resolver

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 Avaliação positiva
darrengates
Solução
Membro

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

resolver

It looks like the answer is:

{% set pageType = content.CMSContentType %}