Next.js for Drupal
Next-generation front end for your Drupal site.
Demo
Documentation
https://next-drupal.org
Deploy to Vercel
Example
A page with all "Article" nodes.
import { DrupalClient, DrupalNode } from "next-drupal"
const drupal = new DrupalClient("https://drupal.org")
interface BlogPageProps {
articles: DrupalNode[]
}
export default function BlogPage({ articles }: BlogPageProps) {
return (
<div>
{articles?.length
? nodes.map((node) => (
<div key={node.id}>
<h1>{node.title}</h1>
</div>
))
: null}
</div>
)
}
export async function getStaticProps(
context
): Promise<GetStaticPropsResult<BlogPageProps>> {
const articles = await drupal.getResourceCollectionFromContext<DrupalNode[]>(
"node--article",
context
)
return {
props: {
articles,
},
}
}
Supporting organizations
Development sponsored by Chapter Three