I'm having an issue getting this working with a Drupal 11 site in a subdirectory. Is this the forum?
Unanswered
Citrus blackfly parasitoid posted this in #help-forum
Citrus blackfly parasitoidOP
Specifically, in lib/drupal.ts, I had to add this fetcher override to get both the node listing and individual node pages to work:
import { NextDrupal } from "next-drupal"
const baseUrl = 'http://127.0.0.1/drupal_bootstrap/web'//process.env.NEXT_PUBLIC_DRUPAL_BASE_URL as string
const clientId = process.env.DRUPAL_CLIENT_ID as string
const clientSecret = process.env.DRUPAL_CLIENT_SECRET as string
console.log("REQUESTING:", baseUrl);
export const drupal = new NextDrupal(
baseUrl,
{
fetcher: async (url, options) => {
url = url
.replace(
'http://127.0.0.1/jsonapi',
'http://127.0.0.1/drupal_bootstrap/web/jsonapi'
)
.replace(
'http://127.0.0.1/router',
'http://127.0.0.1/drupal_bootstrap/web/router'
);
console.log("FINAL URL:", url);
return fetch(url, options);
}
}
);
import { NextDrupal } from "next-drupal"
const baseUrl = 'http://127.0.0.1/drupal_bootstrap/web'//process.env.NEXT_PUBLIC_DRUPAL_BASE_URL as string
const clientId = process.env.DRUPAL_CLIENT_ID as string
const clientSecret = process.env.DRUPAL_CLIENT_SECRET as string
console.log("REQUESTING:", baseUrl);
export const drupal = new NextDrupal(
baseUrl,
{
fetcher: async (url, options) => {
url = url
.replace(
'http://127.0.0.1/jsonapi',
'http://127.0.0.1/drupal_bootstrap/web/jsonapi'
)
.replace(
'http://127.0.0.1/router',
'http://127.0.0.1/drupal_bootstrap/web/router'
);
console.log("FINAL URL:", url);
return fetch(url, options);
}
}
);