You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

next-drupal

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-drupal

Helpers for Next.js + Drupal.

1.0.1
Source
npm
Version published
Weekly downloads
10K
14.03%
Maintainers
1
Weekly downloads
 
Created
Source
next-drupal

Next.js for Drupal

Next-generation front end for your Drupal site.

Demo

  • https://demo.next-drupal.org
  • http://cms-drupal.vercel.app

Documentation

https://next-drupal.org/docs

Example

A page with all "Article" nodes.

import { getResourceCollectionFromContext, DrupalNode } from "next-drupal"

interface BlogPageProps {
  nodes: DrupalNode[]
}

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

export async function getStaticProps(
  context
): Promise<GetStaticPropsResult<BlogPageProps>> {
  const nodes = await getResourceCollectionFromContext<DrupalNode[]>(
    "node--article",
    context
  )

  return {
    props: {
      nodes,
      revalidate: 60,
    },
  }
}

Supporting organizations

Development sponsored by Chapter Three

Keywords

next.js

FAQs

Package last updated on 21 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts