gridsome-airtable-starter icon indicating copy to clipboard operation
gridsome-airtable-starter copied to clipboard

Header Images not showing

Open 5mart4zz opened this issue 4 years ago • 1 comments

I tried to use your starter, everything looks perfect but how do you use the Header Image field from your Airtable base ? If I want to have this pictures showing on the event pages, where should I add and what ? Thanks a lot

5mart4zz avatar Dec 11 '20 14:12 5mart4zz

This is a little tricky to handle properly (which is why I don't have it in my example)

In Event.vue you can update the page-query to be:

<page-query>
query Event ($id: ID!) {
  event: event(id: $id) {
    id
    name
    startDate
    endDate
    notes
    headerImage{
      url
    }
    attachments {
      id
      url
      filename
    }
  }
}
</page-query>

and then add an image with something like:

<img :src="$page.event.headerImage[0].url" width="400"> </img>

It is important to note that $page.event.headerImage returns an array, not the single file. Depending on exactly what you're trying to accomplish, the best approach may involve ensuring all your images uploaded to Airtable are a consistent quality/aspect ratio.

TerabyteTiger avatar Dec 21 '20 16:12 TerabyteTiger