# export to template context question

**URL:** <https://community.hubspot.com/t/export-to-template-context-question/10528>\
**Category:** CMS Development\
**Created:** [October 10, 2018, 6:32pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528 "2018-10-10T18:32:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jestlinbaum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jestlinbaum/32/68653_2.png) [@jestlinbaum](https://community.hubspot.com/u/jestlinbaum)\
**Post date:** [October 10, 2018, 6:32pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/1 "2018-10-10T18:32:24Z")

</div>

I have two blogs:

Default: Posts

Team Members: Member bios and contact information

On each bio (in Team blog) , I’m trying to display the 3 most recent posts by each member (found in Default blog.)

When I use the following code in the **team blog post template** , it works. I get the 3 recent results from john-doe.

```auto
{% set author_posts = blog_recent_author_posts('default', 'john-doe', 3) %}
{% for author_post in author_posts %}
 <div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

However, I need this to be team-member-specific.

So, to the **Team Member blog page** , I added a field to enter the author slug:

`{% text "authslug" label="Author Slug", export_to_template_context=True %}`

And I am able to output that value in my template with:

`{{ content.widgets.authslug.body.value }}`

EXCEPT, for when I try to put that code into the call for the 3 posts:

```auto
{% set author_posts = blog_recent_author_posts('default', '{{ content.widgets.authslug.body.value }}', 3) %}
{% for author_post in author_posts %}
 <div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

Any ideas on how to get the team member’s author slug(from default blog) to output in the code above?

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [October 10, 2018, 7:02pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/2 "2018-10-10T19:02:34Z")

</div>

@jestlinbaum - I’m not at computer right now but, I think there’s an allWidgets index in the dict.

Try inspecting the data from

`{{content.allWidgets|pprint}}`

see if it’s in there.

---

<div class="post-metadata">

**Author:** ![jestlinbaum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jestlinbaum/32/68653_2.png) [@jestlinbaum](https://community.hubspot.com/u/jestlinbaum)\
**Post date:** [October 11, 2018, 5:13pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/3 "2018-10-11T17:13:12Z")

</div>

@tjoyce yes it’s in there. I am able to output the field anywhere in the template EXCEPT in the call to the other blog.

I am on the Team Blog post template calling for articles from the Default Blog. When I put in the author slug it works correctly:

```auto
{% set author_posts = blog_recent_author_posts('5686817676', 'john-doe', 3) %}
{% for author_post in author_posts %}
 <div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

But when I try to populate the author slug from the custom field in the Team Post it does not work:

```auto
{% set author_posts = blog_recent_author_posts('5686817676', '{{ content.widgets.authslug.body.value }}', 3) %}
{% for author_post in author_posts %}
 <div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

‘5686817676’ is referencing the Default Blog. However ‘{{ content.widgets.authslug.body.value }}’ is referencing a custom field from the Team Blog post (the template I am working in). I think that is why it is not working. I’m wondering if there is a workaround.

---

<div class="post-metadata">

**Author:** ![jestlinbaum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jestlinbaum/32/68653_2.png) [@jestlinbaum](https://community.hubspot.com/u/jestlinbaum)\
**Post date:** [October 11, 2018, 5:31pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/4 "2018-10-11T17:31:03Z")

</div>

@tjoyce yes it shows up. I can get the value to print anywhere EXCEPT in the call to the default blog.

I am on the Team Blog post template calling for articles from the Default Blog. When I put in the author slug it works correctly:

```auto
{% set author_posts = blog_recent_author_posts('5686817676', 'john-doe', 3) %}
{% for author_post in author_posts %}
<div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

But when I try to populate the author slug from the custom field in the Team Post it does not work:

```auto
{% set author_posts = blog_recent_author_posts('5686817676', '{{ content.widgets.authslug.body.value }}', 3) %}
{% for author_post in author_posts %}
<div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

‘5686817676’ is referencing the Default Blog. However ‘{{ content.widgets.authslug.body.value }}’ is referencing a custom field from the Team Blog post (the template I am working in). I think that is why it is not working. I’m wondering if there is a workaround.

---

<div class="post-metadata">

**Author:** ![jestlinbaum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jestlinbaum/32/68653_2.png) [@jestlinbaum](https://community.hubspot.com/u/jestlinbaum)\
**Post date:** [October 11, 2018, 5:35pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/5 "2018-10-11T17:35:15Z")

</div>

@tjoyce yes it shows up. I can get the value to print anywhere EXCEPT in the call to the default blog.

I am on the Team Blog post template calling for articles from the Default Blog. When I put in the author slug it works correctly:

```auto
{% set author_posts = blog_recent_author_posts('5686817676', 'john-doe', 3) %}
{% for author_post in author_posts %}
<div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

But when I try to populate the author slug from the custom field in the Team Post it does not work:

```auto
{% set author_posts = blog_recent_author_posts('5686817676', '{{ content.widgets.authslug.body.value }}', 3) %}
{% for author_post in author_posts %}
<div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

‘5686817676’ is referencing the Default Blog. However ‘{{ content.widgets.authslug.body.value }}’ is referencing a custom field from the Team Blog post (the template I am working in). I think that is why it is not working. I’m wondering if there is a workaround.

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [October 12, 2018, 4:30pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/6 "2018-10-12T16:30:58Z")

</div>

yea @jestlinbaum - this is a long shot but sometimes I have to do

`{{ content.allWidgets.authslug.body.value }}`

aside from that, maybe @Jsum knows what’s going on here.

---

<div class="post-metadata">

**Author:** ![Jsum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jsum/32/20405_2.png) [@Jsum](https://community.hubspot.com/u/Jsum)\
**Post date:** [October 12, 2018, 5:05pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/7 "2018-10-12T17:05:14Z")

</div>

@jestlinbaum you have a simple syntax error.

I can’t impress with terminology, but basically you create a python ‘environment’ inside of code blocs wrapped in “{{ }}” or “{% %}”. Creating an ‘environment’ inside of an ‘environment’ is redudant. Feel free to check me on my phrasing.

```auto
{% set author_posts = blog_recent_author_posts('default', content.widgets.authslug.body.value, 3) %}
{% for author_post in author_posts %}
 <div class="post-title">{{ author_post.name }}</div>
{% endfor %}

```

I removed the curlys and the quotes. Now you are essentially calling a variable inside of your code block instead of printing the string ‘{{content.widgets.authslug.body.value}}’ which is what is happening in your code.

Need help? [Hire Us Here](https://www.upwork.com/o/companies/_~0124e15ff34efb3871/)

---

<div class="post-metadata">

**Author:** ![jestlinbaum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jestlinbaum/32/68653_2.png) [@jestlinbaum](https://community.hubspot.com/u/jestlinbaum)\
**Post date:** [October 16, 2018, 4:54pm UTC](https://community.hubspot.com/t/export-to-template-context-question/10528/8 "2018-10-16T16:54:13Z")

</div>

@Jsum ah I see.

Your fix is working perfectly. Thank you so much!
