adonis0302 / next-drupal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Next.js for drupal

Next.js for Drupal

Next-generation front-end for your Drupal site.

Demo

https://demo.next-drupal.org

Documentation

https://next-drupal.org

Deploy to Vercel

Deploy with Vercel

Example

A page with all "Article" nodes.

import { DrupalClient } from "next-drupal"

const drupal = new DrupalClient("https://cms.next-drupal.org")

export default function BlogPage({ articles }) {
  return (
    <div>
      {articles?.length
        ? nodes.map((node) => (
            <div key={node.id}>
              <h1>{node.title}</h1>
            </div>
          ))
        : null}
    </div>
  )
}

export async function getStaticProps(context) {
  const articles = await drupal.getResourceCollectionFromContext(
    "node--article",
    context
  )

  return {
    props: {
      articles,
    },
  }
}

Supporting organizations

Development sponsored by Chapter Three

Contributing

If you're interested in contributing to Next.js for Drupal, please read the contributing guidelines before submitting a pull request.

About

License:MIT License


Languages

Language:TypeScript 37.9%Language:PHP 36.2%Language:MDX 23.4%Language:CSS 1.2%Language:JavaScript 0.9%Language:Shell 0.4%