CMS Development

SnS_Nathan
Participant

Fetch metadata url's

SOLVE

Hello devs.
I have a module on my website where i highlight a page from my website. i'm trying to automatically fetch the featured image, title and url attached to that page. Is there a way to do this in HubL or Hubspot?

All suggestions are welcome!

0 Upvotes
1 Accepted solution
amwilie
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Fetch metadata url's

SOLVE

You can use the content_by_id function to get a specific page's content. If you're doing this in a custom module you can use the page field to easily get the ID of the page.

 

page_field.png

 

{% set page = content_by_id(module.page_field) %}
Title: {{ page.name }}
URL: {{ page.absolute_url }}
Featured Image: <img src="{{ page.featured_image }}" />

 

If this answer solved your question, please mark it as the solution!

Alyssa Wilie

Web Developer at Lynton

explore hubspot themes from lynton

Need custom website/integration development or help optimizing HubSpot for your organization?
Schedule a consultation with us, an award-winning HubSpot Elite Partner.


Or check out our blog to get the latest in marketing, design, integration, and HubSpot knowledge.

 

View solution in original post

1 Reply 1
amwilie
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Fetch metadata url's

SOLVE

You can use the content_by_id function to get a specific page's content. If you're doing this in a custom module you can use the page field to easily get the ID of the page.

 

page_field.png

 

{% set page = content_by_id(module.page_field) %}
Title: {{ page.name }}
URL: {{ page.absolute_url }}
Featured Image: <img src="{{ page.featured_image }}" />

 

If this answer solved your question, please mark it as the solution!

Alyssa Wilie

Web Developer at Lynton

explore hubspot themes from lynton

Need custom website/integration development or help optimizing HubSpot for your organization?
Schedule a consultation with us, an award-winning HubSpot Elite Partner.


Or check out our blog to get the latest in marketing, design, integration, and HubSpot knowledge.