content icon indicating copy to clipboard operation
content copied to clipboard

Follow symlinks inside `content/`

Open jamesaorson opened this issue 9 months ago • 3 comments

Is your feature request related to a problem? Please describe

I want to be able to symlink directories into the content/ dir, or as the content/ dir itself.

When using queryContent in Nuxt v2, or queryCollection in Nuxt v3, symlinks are ignored and I am unable to query for their contents.

Describe the solution you'd like

I would like to be able to do the following

mkdir content
cd content
ln -s ../node_modules/symbolics-data
npm run dev
# See symbolics-data be queryable

Describe alternatives you've considered

I have tried symlinking different levels of the directories, and it seems that it just stops following the moment it hits a symlink.

Additional context

A screenshot of the directory I was trying to use. content was a real directory, containing a symlink to ../node_modules/symbolics-data

We were using a symlink to a directory installed via npm, but if we replace the symlink with the directory itself, nuxt content is super happy and does as we wish.

Image

jamesaorson avatar Mar 25 '25 14:03 jamesaorson

Instead of using symlinks, you can create a collection from an external source. All you need is to define cwd in your collection's source. Checkout https://content.nuxt.com/docs/collections/sources#cwd

farnabaz avatar Mar 26 '25 13:03 farnabaz

I know I can define this other collection, but why can’t I just use a symlink as well? Is there some kind of design reason Nuxt does not want to follow symlinks?

jamesaorson avatar Mar 30 '25 07:03 jamesaorson

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar May 29 '25 08:05 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity.

github-actions[bot] avatar Jun 28 '25 09:06 github-actions[bot]