nuxt-modules / nuxt-modules/sanity

Extending prerender routes with Sanity

Open
#581 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
TypeScript
Stars
265
Forks
43
Avg merge
11h
Merged PRs (30d)
18

Description

I'm trying to extend prerender routes fallowing this example

export default defineNuxtConfig({
  hooks: {
    async 'nitro:config' (nitroConfig) {
      if (nitroConfig.dev) { return }
      // ..Async logic..
      nitroConfig.prerender.routes.push('/custom')
    }
  }
})

At this point I believe Sanity Client is not initialized.
I'm straggling to call Sanity and pass the array of dynamic routes who are not prerender by Nitro.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the nitro:config hook shown in the issue and trace when the Sanity Client becomes available relative to Nitro prerender setup. Compare the linked Nuxt example and verify a supported way to add Sanity-backed dynamic routes to nitroConfig.prerender.routes; done means those routes are collected and prerendered.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.