Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running nuxt generate, if there is a dot (".") in the path of a content file, the gives 404 #2765

Open
pmcp opened this issue Aug 25, 2024 · 2 comments

Comments

@pmcp
Copy link

pmcp commented Aug 25, 2024

Environment

  • Operating System: Darwin
  • Node Version: v20.14.0
  • Nuxt Version: 3.13.0
  • CLI Version: 3.13.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, modules, routeRules, compatibilityDate
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Reproduction

You can find a test repo here: https://github.com/pmcp/nuxtContentPathIssue

If a page is added to the content folder that has a dot, it will not be generated when running nuxt generate.

Describe the bug

I don't know if this by design, but I couldn't find any info about this. If I overlooked, I apologise!

I came across the issue that when I generate pages, they won't generate. After some test I've found out that the reason was dots in the path of the pages.

In the test repo I have a file with and without a dot. You can see when generating that only the file without dot gets generated.

Additional context

I use DecapCMS, with content in different languages. The i18n setup of Decap uses dots in the paths of the files to distinguish between languages (https://decapcms.org/docs/i18n/).

Logs

No response

@pmcp
Copy link
Author

pmcp commented Aug 25, 2024

I just found another issue mentioning the same error: #2368

@farnabaz
Copy link
Member

This is related to Nitro's pre-render logic which does not crawl routes with unknown extension. (Having do in file name is like having a dot in a route, and characters after dot will taken as file extension)

What you can do it to manually add those routes into routeRules in nuxt.config.ts. In your case:

export default defineNuxtConfig({
  routeRules: {
    '/about.something': { prerender: true },
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants