Contentful logo

Contentful Community

Contentful + Eleventy: How do you retrieve linked entries?

Hey, first of all I’m not too technical.

I’ve got a list of articles in Contentful which I’m pulling to Eleventy (using this guide - Getting Content from Contentful into Eleventy | ianjmacintosh.com). The article content type is a bunch of text fields and a linked field to my categories which is another content type.

Displaying the articles is fine etc but what I can’t figure out is how to display my list of categories in a category page.

This is what I’m using to pull content from Contentful.

module.exports = function() {
  return client
    .getEntries({
      content_type: 'helpArticle',
    })
    .then(function(response) {
      const items = response.items.map(function(item) {
        return item;
      });

      return items;
    })
    .catch(console.error);
};