NOGN

Templates in Gridsome are in the src/templates directory. For Craft elements, follow the format:

  • Entries: craftEntry${sectionHandle}${typeHandle}.vue
    Example - src/craftEntryNewsArticle.vue
  • Categories: craftCategory${groupHandle}.vue
    Example: craftCategoryStatus.vue
  • Tags: craftTag${groupHandle}.vue
    Example - craftTagCountries.vue

An example template files for an Entry:

<template>
  <Layout>
    <h1>{{ $page.craft.entry.title }}</h1>
    <div>
      {{ $page.craft.entry.articleBody }}
    </div>
  </Layout>
</template>

<page-query>
query CraftEntry ($id: [craft_QueryArgument]) {
  craft {
    entry (id: $id) {
      title
      ... on craft_news_article_Entry {
        articleBody
      }
    }
  }
}
</page-query>