A page with all "Article" nodes.
import{DrupalClient}from"next-drupal"
constdrupal=newDrupalClient("https://cms.next-drupal.org")
exportdefaultfunctionBlogPage({articles}){
return(
<div>
{articles?.length
?nodes.map((node)=>(
<divkey={node.id}>
<h1>{node.title}</h1>
</div>
))
:null}
</div>
)
}
exportasyncfunctiongetStaticProps(context){
constarticles=awaitdrupal.getResourceCollectionFromContext(
"node--article",
context
)
return{
props:{
articles,
},
}
}
Development sponsored byChapter Three
If you're interested in contributing to Next.js for Drupal, please read thecontributing guidelinesbefore submitting a pull request.