Fat Buddha Designs

Affordable, Creative, Hand-Crafted Websites

Items in nodes

Items in nodes in Gridsome

Author: Will Moody

Published:

Reading Time: (approx) 1 min

Tags that this post has been filed under.

This is just a small code change that was pointed out to me by @courcelan on the Gridsome Discord.

<article v-for="item in $page.sitepages.edges" :key="item.node.id">

Can be replaced with

<article v-for="{ node } in $page.sitepages.edges" :key="node.id">

And then used like this:-

<h2></h2>
<div v-html="node.content" />

The item can then be missed out, just a little bit less typing, which is great.

Previous Article: My Coding Setup

Next Article: Importing Data from a json file