nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.11k stars 624 forks source link

Feature Request: Multi-site support with domain-based content directories #2807

Open maximepvrt opened 1 week ago

maximepvrt commented 1 week ago

Description

I would like to request a feature to enable multi-site support within Nuxt Content by allowing domain-specific directories in the root content/ folder. These directories should correspond to different domains but should not be reflected in the URL structure, only in the resource paths (i.e., the content's id).

This feature would be inspired by the syntax introduced in Nuxt 3.13 with Route Groups, which allows organizing routes in directories enclosed in parentheses without affecting the URL structure. For example, in an app with the following structure:

-| pages/
---| index.vue
---| (marketing)/
-----| about.vue
-----| contact.vue

The generated URLs would be /, /about, and /contact without including the marketing folder in the URL path.

Similarly, in Nuxt Content, this would allow structuring content like this:

-| content/
---| (site1)/
-----| blog-post-1.md
---| (site2)/
-----| blog-post-2.md

Where site1 and site2 are different domains, but the resulting URLs would only include the post paths without the domain-specific folders, for example:

Proposed Solution

Utilize a similar approach to Route Groups, where directories enclosed in parentheses (or another syntax) could serve as groupings for different domains or sites. This would enable multi-site support while keeping the URL structure clean.

Benefits

maximepvrt commented 4 days ago

@farnabaz I was wondering if this feature might be possible with the upcoming v3 of Nuxt Content and the new Collections feature? Would Collections allow us to organize content by domain in separate directories without affecting the URL structure, similar to what I’ve proposed above?

farnabaz commented 4 days ago

Indeed, this can be done with content collections. Collection are separated entities that can be queried separately. Just like your proposal, content's path will be clean, and they will no prefixes.