Warm tip: This article is reproduced from serverfault.com, please click

Deploy VuePress to GitHub pages

发布于 2020-04-27 09:14:22

Trying to deploy this docs:

https://github.com/aitormendez/democracia/tree/master/docs

to GitHub page: https://aitormendez.github.io/democracia/

I get something different in local dev and Github.

This is the look in local dev:

This is the look in local dev

And this is the look at GithHub:

this is the look at GithHub

Also, .vuepress/dist/index.html looks like:

enter image description here

this is the config.js:

https://github.com/aitormendez/democracia/blob/master/docs/.vuepress/config.js

module.exports = {
    home: true,
    title: 'Democracia. Manual de uso web',
    base: '/democracia/',
    themeConfig: {
        nav: [
            {text: 'Democracia', link: 'https://democracia.com.es'}
        ],
        sidebar: [
            {
                title: 'Contenido',
                collapsable: false,
                children: [
                '/',
                'front-page',
                ]
            },
        ]
    }
}

package.json:

https://github.com/aitormendez/democracia/blob/master/package.json

{
  "devDependencies": {
    "vuepress": "^1.4.1"
  },
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  }
}

And deploy.sh

#!/usr/bin/env sh
set -e
npm run docs:build
cd docs/.vuepress/dist
git init
git add -A
git commit -m 'deploy'
git push -f git@github.com:aitormendez/democracia.git master:gh-pages
cd -

AFAIK, I've followed the deploy to Github steps: https://vuepress.vuejs.org/guide/deploy.html#github-pages

What am I doing wrong?

Questioner
aitor
Viewed
0
Max 2021-05-16 03:08:49

Had a similar issue. You need to set the correct base in docs/.vuepress/config.js. Let's say your repository is at https://github.com/[USERNAME]/[REPO], then you need to set base to "/[REPO]/". In other words when you go to Settings>Pages and you see a message: "Your site is published at https://xxxxxx77.github.io/xxxxxGuide/" - you need to set /xxxxxGuide/ as your base.

This is how my config.js looks like :

module.exports = {
    title: 'xxxxx',
    description: 'xxxxxx',
    base: "/xxxxGuide/"
}