content icon indicating copy to clipboard operation
content copied to clipboard

Base public path option

Open kazupon opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe

Sometimes we want to deliver the public path of nuxt/content in a sub directory(e.g. /v8) instead of the root /. In the nuxtjs/i18n use case, I want to run the v7 and v8 alpha versions of the documentation on the same domain, but on separate git branches.

ref: https://github.com/nuxt-community/i18n-module/discussions/1287#discussioncomment-3493467

Describe the solution you'd like

We hope configration like vite base option. https://vitejs.dev/config/shared-options.html#base

Describe alternatives you've considered

sources configration https://content.nuxtjs.org/api/configuration#sources

Additional context

kazupon avatar Aug 30 '22 06:08 kazupon

WDYT @farnabaz ?

atinux avatar Aug 30 '22 07:08 atinux

I like the idea of having a base, especially in documentDriven mode which the catch-all page can register under this base path and the rest URLs will be handled normally by Nuxt pages.

however, without the need for any changes, this can be done using sources by adding prefix to the content source

export default defineNuxtConfig({
  content: {
    sources: [
      {
        name: 'content',
        prefix: '/v8',
        driver: 'fs',
        base: resolve(__dirname, 'content')
      }
    ]
  }
})

farnabaz avatar Aug 30 '22 08:08 farnabaz