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

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

Open
maximepvrt opened this issue Oct 9, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@maximepvrt
Copy link
Contributor

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:

  • /blog-post-1 (retrievable from queryContent('/site1/blog-post-1').findOne())
  • /blog-post-2 (retrievable from queryContent('/site2/blog-post-2').findOne())

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

  • Simplifies multi-site setups without needing complex folder structures or custom routing.
  • Allows managing multiple domains within the same content repository.
  • Keeps the URL structure clean and focused on the content, without referencing domain-specific organization.
@maximepvrt maximepvrt added the enhancement New feature or request label Oct 9, 2024
@maximepvrt
Copy link
Contributor Author

@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
Copy link
Member

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.

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

No branches or pull requests

2 participants