Items in nodes

Posted By Will Moody On , Reading Time - 1 minutes

Code

Items in nodes in gridsome

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>{{ node.title }}</h2>
<div v-html="node.content" />

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