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
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | 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 Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

1 Reply 1
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | 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 Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.