Skip to content

Commit

Permalink
feat: update menu strucutre and mark areas in docs that need to be ex…
Browse files Browse the repository at this point in the history
…panded for Pages router
  • Loading branch information
backlineint committed Oct 11, 2024
1 parent d851246 commit 9dcc592
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 5 deletions.
10 changes: 9 additions & 1 deletion www/config/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const docsConfig: DocsConfig = {
],
},
{
title: "Drupal Client",
title: "NextDrupal Client",
items: [
{
title: "Introduction",
Expand Down Expand Up @@ -94,6 +94,10 @@ export const docsConfig: DocsConfig = {
title: "Advanced Example",
href: "/docs/pages#advanced-example",
},
{
title: "Pages Router",
href: "/docs/pages#pages-router",
},
],
},
{
Expand Down Expand Up @@ -196,6 +200,10 @@ export const docsConfig: DocsConfig = {
title: "getAuthorizationHeader",
href: "/docs/reference/getauthorizationheader",
},
{
title: "Pages Router",
href: "/docs/reference/pages-router",
},
],
},
{
Expand Down
8 changes: 6 additions & 2 deletions www/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ export const site: SiteConfig = {
},
versions: [
{
version: "v1.6.0",
version: "v2.0.0",
active: true,
},
{
version: "v1.0.0",
version: "v1.6.0",
url: "https://v1.next-drupal.org",
},
{
version: "canary",
url: "https://next.next-drupal.org",
},
],
}
10 changes: 10 additions & 0 deletions www/content/blog/next-drupal-2-0.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Next-Drupal 2.0
author: brianperry
date: October 31, 2024
created: "2024-10-31"
excerpt: Next.js 14, Drupal 11 and App Router Support.
published: true
---

Write this post.
6 changes: 6 additions & 0 deletions www/content/docs/client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ It also comes with full support for JSON:API write operations which means you ca

## Usage

### App Router

```ts
import { NextDrupal } from "next-drupal"

Expand All @@ -41,3 +43,7 @@ const article = await drupal.getResource(
"f4c61473-8297-4bf3-bab7-21c9633a7ca7"
)
```

### Pages Router

TODO
6 changes: 6 additions & 0 deletions www/content/docs/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ excerpt: Initialization and options for NextDrupal client.

## Initialization

### App Router

To create a new `NextDrupal` client, use the following initialization:

```ts
Expand All @@ -19,6 +21,8 @@ Where `NEXT_PUBLIC_DRUPAL_BASE_URL` is the URL to your Drupal site defined as an
NEXT_PUBLIC_DRUPAL_BASE_URL=http://example.com
```

### Pages Router

---

## Options
Expand Down Expand Up @@ -226,3 +230,5 @@ JSON:API errors are thrown in non-production environments by default. The errors
By default, the resource endpoint will be based on the resource name. If you turn this off, a JSON:API request will retrieve the resource's endpoint url.

---

TODO - Call out any App Router or Pages Router specific options here.
4 changes: 4 additions & 0 deletions www/content/docs/deserializer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ export const drupal = new NextDrupal(process.env.NEXT_PUBLIC_DRUPAL_BASE_URL, {
deserializer: customDeserializer,
})
```

### Pages Router

TODO - the option was called serializer
4 changes: 4 additions & 0 deletions www/content/docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ excerpt: Frequently Asked Questions about Next.js for Drupal

Next.js for Drupal works requires Drupal 9.3+ and Drupal 10.

## Which Next.js versions are supported?

Next.js for Drupal supports both Next.js 13 and Next.js 14. This includes support for both the App Router and the Pages Router.

## Does it work without authentication?

Yes. Authentication is only required for previewing unpublished entities and revisions.
Expand Down
4 changes: 4 additions & 0 deletions www/content/docs/pages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,7 @@ export default function Page({ params }) {
## Reference

See the [fetching JSON:API resources](/docs/fetching-resources) section for more examples of fetching resources and collection of resources.

## Pages Router

TODO
9 changes: 9 additions & 0 deletions www/content/docs/reference/pages-router.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Pages Router
excerpt: An index of methods specific to the Pages Router.
---

TODO

- Link 1
- Link 2
36 changes: 36 additions & 0 deletions www/content/docs/upgrade-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,42 @@ title: Upgrade Guide
excerpt: Guide for upgrading your site to use DrupalClient.
---

## next-drupal 2.0.0

1. Upgrade to the latest version

```sh
yarn add next-drupal@latest
```

<Callout>

`next-drupal 2.0.0` adds support for the App Router and maintains support for the Pages Router. For information on transitioning from the Pages Router to the App Router, see the [App Router Incremental Adoption Guide](https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration) guide on the Next.js site.

</Callout>

TODO - Outline breaking changes here.

## next 2.0.0

1. Upgrade your Drupal site to use `next 2.0.0`

```sh
composer require drupal/next
```

2. Run updates:

```sh
drush updb
```

<Callout>

TODO - Describe changes as that will occur as a result of this upgrade.

</Callout>

## next-drupal 1.6.0

1. Upgrade to the latest version
Expand Down
6 changes: 4 additions & 2 deletions www/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ export default function IndexPage({ features }: IndexPageProps) {

return (
<Layout title={site.name} description={site.description}>
TODO - Re-order elements on home page
<section className="relative px-6 pt-12 pb-8 md:py-12 md:pb-8">
<div className="container max-w-4xl mx-auto text-center">
<Link
href="/blog/next-drupal-1-6"
href="/blog/next-drupal-2-0"
passHref
className="inline-flex space-x-1 mx-auto mb-4 bg-[#111] text-white hover:underline text-sm items-center rounded-full px-4 py-1 font-medium"
>
<span>Next.js 13, Drupal 10 and Stable On-demand Revalidation</span>
<span>Next.js 14, Drupal 11 and App Router Support</span>
</Link>
<h1 className="text-4xl font-black tracking-tight text-center md:text-6xl lg:tracking-tighter lg:text-8xl">
The future of Drupal is headless
Expand Down Expand Up @@ -159,6 +160,7 @@ export default function IndexPage({ features }: IndexPageProps) {
A powerful client for working with JSON:API.
</p>
</div>
TODO - Update code below for app router
<div className="container max-w-5xl grid-cols-2 gap-6 mx-auto mt-10 md:grid">
<div className="grid grid-flow-row gap-4 mt-10 md:max-w-md auto-rows-max">
{features.map((feature) => (
Expand Down

0 comments on commit 9dcc592

Please sign in to comment.