CMS Development

SvenVanbrabant
Contributor

Get URL with page ID

SOLVE

I'm using HTML Modules in a Flexible Column on my page template.

I'm linking to several other COS pages in this HTML Module.

 

It might happen that I need to change URLs of the COS pages. However, when I do this the links in the HTML Module will be broken. 

 

Is there a way to receive page URL with page ID?

 

Thanks.

0 Upvotes
1 Accepted solution
anthonypizzurro
Solution
HubSpot Product Team
HubSpot Product Team

Get URL with page ID

SOLVE

Hi Sven,

 

Currently, there is no HubL function to return a URL based on page ID, but I'll pass this idea along to the team in charge.

 

It's worth noting that if you do change a pages URL, we'll automatically create a redirect to the new page for you, so your links should still work. More info on that here.

 

Have a great day,

Anthony

View solution in original post

0 Upvotes
6 Replies 6
GiorgioM
Member | Diamond Partner
Member | Diamond Partner

Get URL with page ID

SOLVE

Hi Sven,

 

currently content_by_id function do the job

 

https://developers.hubspot.com/docs/cms/hubl/functions#content-by-id

 

Regards

Giorgio

GiorgioM
Member | Diamond Partner
Member | Diamond Partner

Get URL with page ID

SOLVE

Hi Sven,

 

content_by_id function do the job

 

https://developers.hubspot.com/docs/cms/hubl/functions#content-by-id

 

Regards

Giorgio

0 Upvotes
anthonypizzurro
Solution
HubSpot Product Team
HubSpot Product Team

Get URL with page ID

SOLVE

Hi Sven,

 

Currently, there is no HubL function to return a URL based on page ID, but I'll pass this idea along to the team in charge.

 

It's worth noting that if you do change a pages URL, we'll automatically create a redirect to the new page for you, so your links should still work. More info on that here.

 

Have a great day,

Anthony

0 Upvotes
victoruu
Member | Partner
Member | Partner

Get URL with page ID

SOLVE

Hi Anthony,

 

Any update for HubL 2018 for this feature? It's also useful in linking some page from extern website. Example www.myhubspotsite.com/?id={pageID}

 

Best regards,

Ray

0 Upvotes
anthonypizzurro
HubSpot Product Team
HubSpot Product Team

Get URL with page ID

SOLVE

Recently we did add a function for getting a page by ID: https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#page-by-id

 

This should solve your original issue. Although, this will not work for external linking.

0 Upvotes
elmo
Contributor

Get URL with page ID

SOLVE

The page_by_id() seems to return nothing if the page is one of a blog (i.e. the blog listing page or a blog post page). I'm using this in a custom module with a field of type Page to convert the selection in the Page dropdown to an URL of the page, but now I can't do that.

 

It'd be logical that the function could work with all the pages that are selectable as pages, which includes the blog listing page and blog post pages.

0 Upvotes