vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.48k stars 4.78k forks source link

Github pages docs/ folder doesn't work with Vue Press #1610

Open sts-ryan-holton opened 5 years ago

sts-ryan-holton commented 5 years ago

Bug report

Steps to reproduce

Hi, I'm experiencing an issue when deploying my Vue Press documentation as part of my priviate Github repo. I cannot provided a demo URL as this may or may not be linked with Vue Press or Github.

I've generated a Vue JS project using the vue create command, I've added the Vue p11n module on top as this is a plugin I'm making.

I've created my Vue Press documentation under the docs/ folder, and locally everything works fine. I haven't touched the config files as everything here is working.

I have a few files:

These are located under docs/, and then there's the .vuepress folder within the docs directory.

Docs URL: https://stsonline.github.io/vue-les-application/

My github repo is private, and has to be.

What is expected?

Documentation on Github pages should load as per the local copy, sidebar should function, and navigation links should work.

What is actually happening?

When I push my changes to the repo, my github pages url appears to only load the README.md file, whilst leaving everything else non functional, e.g: unable to access those pages.

My repo url example is: https://stsonline.github.io/vue-les-application/

When clicking the Get Started link, it should link to the installation page, but doesn't also the sidebar nav is missing.

However, running locally, everything is fine, including the lovely green theme.

What am I missing?

I have to keep a parent docs/ folder, as this is the folder used for the Github pages, and I cannot use a parent dist/ directory. That being said, Vue Press appears to build that inside the docs directory.

My docs/.vuepress/config.js file:

module.exports = {
  base: '/vue-les-application/',
  plugins: [
    require('./plugin.js')
  ],
  locales: {
    '/': {
      lang: 'en-US',
      title: 'VueLesApplication',
      description: 'VueLesApplication for Vue.js'
    }
  },
  themeConfig: {
    repo: '/vue-les-application',
    docsDir: 'docs',
    locales: {
      '/': {
        label: 'English',
        selectText: 'Languages',
        editLinkText: 'Edit this page on GitHub',
        nav: [{
          text: 'Release Notes',
          link: 'https://github.com//vue-les-application/releases'
        }],
        sidebar: [
          '/requirements.md',
          '/installation.md',
          '/options.md'
        ]
      }
    }
  }
}

My docs/.vuepress/plugin.js file:

const { version } = require('../../package.json')

module.exports = (/*options, ctx*/) => ({
  async enhanceAppFiles () {
    const code = `export default ({ Vue }) => {
  Vue.mixin({
    computed: {
      $version () {
        return '${version}'
      } 
    }
  })
}`
    return [{
      name: 'vuepress-plugin-vue-cli-plugin-p11n',
      content: code
    }]
  }
})

Other relevant information

tomcam commented 4 years ago

I believe you need to :

Also remember of course that the repo is private but the GitHub Pages rendering will be public.

petedavisdev commented 3 years ago

base: '/vue-les-application/' is correct.

Can you share the build script from your package.json and the deploy script you are using?

Here is an easy way to deploy to GitHub pages that may help you.