Skip to content

Conversation

@hendrikheil
Copy link
Contributor

@hendrikheil hendrikheil commented Jan 19, 2026

Resolves #235

This PR should fix an issue in nuxt-studio where collections with prefixes other than / were unable to get their source properly identified by getCollectionSourceById.

Example call:

prefix: "/unternehmen/blog"
fixed: "organization-blog" 
prefixAndPath: "unternehmen/blog/my-entry.md"

content.config.ts

organizationBlog: defineCollection({
  type: 'page',
  source: {
    include: 'organization-blog/*.md',
    prefix: '/unternehmen/blog',
  },
}),

Previously, this code would have tried to build the fsPath by replacing prefix from prefixAndPath, however, prefixAndPath never actually starts with a / meaning the string replace did nothing.

This PR removes the leading / from the prefix to properly determine the fsPath.

I believe this is also tied to the use of simple include patterns, which do not leverage the double wildcard **. I created a test to validate my change. It fails prior to withoutLeadingSlash

@vercel
Copy link
Contributor

vercel bot commented Jan 19, 2026

@hendrikheil is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 19, 2026

npm i https://pkg.pr.new/nuxt-content/nuxt-studio@291

commit: 26885d2

@vercel
Copy link
Contributor

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
content-studio Ready Ready Preview, Comment Jan 19, 2026 1:10pm
nuxt.studio Ready Ready Preview Jan 19, 2026 1:10pm

@larbish larbish merged commit 81450ab into nuxt-content:main Jan 19, 2026
5 checks passed
@hendrikheil hendrikheil deleted the fix/source/properly-identify-sources-with-prefix branch January 19, 2026 14:20
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

Successfully merging this pull request may close these issues.

Editor now showing files while having a collection with prefix: "/something"

2 participants