Share Your Work

mateomm22
Participant

Export custom module content to another template

SOLVE

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.

0 Upvotes
1 Accepted solution
JasonRosa
Solution
HubSpot Employee
HubSpot Employee

Export custom module content to another template

SOLVE

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!

View solution in original post

2 Replies 2
JasonRosa
Solution
HubSpot Employee
HubSpot Employee

Export custom module content to another template

SOLVE

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!

mateomm22
Participant

Export custom module content to another template

SOLVE

It worked!
Thank you so much!

0 Upvotes