lunr-module icon indicating copy to clipboard operation
lunr-module copied to clipboard

bug: public path - how to handle subdomain subdirectories

Open lastlink opened this issue 4 years ago • 2 comments

  • when I deploy to gitlab in a subdirectory I'm having issues getting the search json to work
  • I'm going to try updating the public path
    • didn't work as expected, does a duplicate path call

examples

  • https://github.com/lastlink/netlify-cms-nuxt
    • https://lastlink.github.io/netlify-cms-nuxt search won't work b/c not root
  • https://funktechno.gitlab.io/ works b/c it is root

lastlink avatar Feb 24 '21 02:02 lastlink

best I can see is to update the publicpath in the build in nuxt.config.js

 build: {
    extractCSS: true,
    //publicPath: 'PATHPREFIXTOREPLACE/_nuxt',

but this is causing a bunch of path issues for me still w/ a duplicate. e.g. public path 2x for somereason when manually updated.

lastlink avatar Feb 24 '21 03:02 lastlink

@lastlink Faced the same issue. How I worked it around:

First add this to nuxt.config.js

 router: {
    base: process.env.ENV_SUB_PATH || '/'
  } 

and

build: {
  publicPath: (process.env.ENV_SUB_PATH || '/') + '_nuxt'
},

Then define ENV_SUB_PATH as /$CI_PROJECT_NAME/ within your ci/cd variables or pipeline

And then everywhere where its not root (has subdomains) you can do the same movements as here .

PetrusHahol avatar Mar 23 '21 20:03 PetrusHahol