# fetchLinks not working for me?

**URL:** <https://community.prismic.io/t/fetchlinks-not-working-for-me/5739>\
**Category:** Developing with Prismic\
**Tags:** nuxtjs\
**Created:** [June 10, 2021, 2:09pm UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739 "2021-06-10T14:09:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardarran](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@richardarran](https://community.prismic.io/u/richardarran)\
**Post date:** [June 10, 2021, 2:09pm UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739/1 "2021-06-10T14:09:43Z")

</div>

Hi I'm trying to pull through a country that I've associated with my document. As I understand fetch links should do that?

Here is my code:

async asyncData({ $prismic, params, error }) {

```
try{

  // Query to get post content

  const document = (await $prismic.api.getByUID('photo', params.uid, { fetchLinks: 'country.name' })).data

  // Returns data to be used in template

  return {

    document,

                

  }

} catch (e) {

  // Returns error page

  error({ statusCode: 404, message: 'Page not found' })

}

```

}

}

And then in the template:

{{ $prismic.asText(document.country.name) }}

Any ideas?

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [June 10, 2021, 4:32pm UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739/2 "2021-06-10T16:32:34Z")

</div>

Hey @richardarran, welcome to the Community!

Fetch Links will help you retrieve content from linked documents. In your case, it should work if you have a `photo` Custom Type with a Content Relationship (AKA Document Link) field with the API ID `country` which links to a document of the type `country`. Then, Inside the country document, you have a Key Text field with the API ID `name`.

Is this how your documents look like?

---

<div class="post-metadata">

**Author:** ![richardarran](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@richardarran](https://community.prismic.io/u/richardarran)\
**Post date:** [June 11, 2021, 8:27am UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739/4 "2021-06-11T08:27:42Z")

</div>

Hi, thanks for your response.

Here is my photo custom type and country custom type

{  
"Main": {  
"uid": {  
"type": "UID",  
"fieldset": "Unique Identifier",  
"config": {  
"placeholder": "UID"  
}  
},  
"date": {  
"type": "Date",  
"fieldset": "Date Added"  
},  
"title": {  
"type": "StructuredText",  
"fieldset": "Photo Title",  
"config": {  
"single": "heading1",  
"placeholder": "Title..."  
}  
},  
"categories": {  
"type": "Group",  
"fieldset": "Categories",  
"config": {  
"fields": {  
"link": {  
"type": "Link",  
"config": {  
"select": "document",  
"customtypes": [  
"category"  
],  
"placeholder": "Link to a category"  
}  
}  
}  
}  
},  
"country": {  
"type": "Link",  
"config": {  
"select": "document",  
"customtypes": [  
"country"  
],  
"label": "Country"  
}  
}  
},  
"Photo Info": {  
"image": {  
"type": "Image",  
"fieldset": "Photo"  
},  
"price": {  
"type": "Number",  
"fieldset": "Price",  
"config": {  
"label": "USD",  
"min": 1,  
"placeholder": "Insert Price..."  
}  
},  
"description": {  
"type": "StructuredText",  
"config": {  
"multi": "paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl",  
"label": "Photo Description",  
"placeholder": "Description..."  
}  
}  
}  
}

{  
"Main" : {  
"uid" : {  
"type" : "UID",  
"config" : {  
"label" : "ID",  
"placeholder" : "Enter an SEO friendly unique ID"  
}  
},  
"name" : {  
"type" : "StructuredText",  
"config" : {  
"single" : "heading1,heading2,heading3,heading4,heading5,heading6",  
"label" : "name",  
"placeholder" : "Country name"  
}  
},  
"description" : {  
"type" : "StructuredText",  
"config" : {  
"multi" : "paragraph,preformatted,heading1,heading2,heading3,heading4,heading5,heading6,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl",  
"label" : "Description",  
"placeholder" : "Enter a country description"  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![richardarran](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@richardarran](https://community.prismic.io/u/richardarran)\
**Post date:** [June 14, 2021, 1:29pm UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739/5 "2021-06-14T13:29:48Z")

</div>

@Pau is what I have correct?

---

<div class="post-metadata">

**Author:** ![richardarran](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@richardarran](https://community.prismic.io/u/richardarran)\
**Post date:** [June 15, 2021, 2:20pm UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739/6 "2021-06-15T14:20:59Z")

</div>

Fixed it! I simply needed to add .data

This works document.country.data.name

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [June 16, 2021, 2:21pm UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739/7 "2021-06-16T14:21:41Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 3:41pm UTC](https://community.prismic.io/t/fetchlinks-not-working-for-me/5739/8 "2021-12-09T15:41:46Z")

</div>


