Export custom module content to another template

SOLVE
Highlighted
New Contributor

Hi!
I'm creating a custom module widget inside a template called "blog-single".
{% text "description" label='Descripción', export_to_template_context=True %},
and i need to get the value of this custom moduel and print it inside a different template "blog-home" like this.
{{ widget_data.description.value }}
but i found out that this works for me only if the two parts of code are inside the same template, ¿is there anyway i can do this?

I'm doing this because i need to make a different text to show in the excerpt of the blogpost not the one i chose inside the blogpost editor.

thank you all.

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Employee

Hey @mateomm22, are you trying to print a value from your post page ("blog-single") to your blog listing page ("blog-home")? If so it looks like your post code is correct with this:

 

{% text "description" label='Descripción', export_to_template_context=True %}

 

Your listing code to output that information would want to look like this: 

 

{{ content.widgets.description.body.value }}

 

Let me know if that doesn't work for you!

2 Replies 2
HubSpot Employee

Hey @mateomm22, are you trying to print a value from your post page ("blog-single") to your blog listing page ("blog-home")? If so it looks like your post code is correct with this:

 

{% text "description" label='Descripción', export_to_template_context=True %}

 

Your listing code to output that information would want to look like this: 

 

{{ content.widgets.description.body.value }}

 

Let me know if that doesn't work for you!

New Contributor

It worked!
Thank you so much!

Reply
0 Upvotes