nextra icon indicating copy to clipboard operation
nextra copied to clipboard

Ability to specify content directory name

Open jajaperson opened this issue 4 months ago • 3 comments

It would be nice to be able to specify an arbitrary path to act as the content directory, e.g. have some .md files stored in /Prose/ and treat this directory the same way content/ is currently.

jajaperson avatar Sep 03 '25 15:09 jajaperson

if you want to submit PR you need to introduce new nextra option e.g. contentDirName and replace this line

https://github.com/shuding/nextra/blob/c6912e2d2bbbed0684e7cc14517524112fafbfca/packages/nextra/src/server/index.ts#L40

with

-function getContentDirectory() {
+function getContentDirectory(contentDirName = 'content') {
  // Next.js gives priority to `app` over `src/app`, we do the same for `content` directory
-  const [contentDir = 'content'] = fg.sync(['{src/,}content'], {
+  const [contentDir = contentDirName] = fg.sync([`{src/,}${contentDirName}`], { 

dimaMachina avatar Sep 21 '25 22:09 dimaMachina

@dimaMachina happy to work on this, although I can't work out what your using to make types.generated.ts from the zod schemata?

jajaperson avatar Sep 25 '25 02:09 jajaperson

You need to run tests and it will be generated https://github.com/shuding/nextra/blob/c6912e2d2bbbed0684e7cc14517524112fafbfca/packages/nextra/package.json#L69

dimaMachina avatar Sep 25 '25 03:09 dimaMachina