APIs & Integrations

darrengates
Member

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

SOLVE
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 Accepted solution
darrengates
Solution
Member

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

SOLVE

It looks like the answer is:

{% set pageType = content.CMSContentType %}

View solution in original post

2 Replies 2
darrengates
Member

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

SOLVE

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
Solution
Member

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

SOLVE

It looks like the answer is:

{% set pageType = content.CMSContentType %}