将 VuePress 部署到 GitHub 个页面

Deploy VuePress to GitHub pages

正在尝试部署此文档:

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

到GitHub页:https://aitormendez.github.io/democracia/

我在本地开发和 Github 中得到了一些不同的东西。

这是本地开发者的样子:

这是 GithHub 上的样子:

此外,.vuepress/dist/index.html 看起来像:

这是 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"
  }
}

和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 -

据我所知,我已经按照 Github 的部署步骤进行操作:https://vuepress.vuejs.org/guide/deploy.html#github-pages

我做错了什么?

github 选项错误。必须将 gh-pages 分支指定为源。

有类似的问题。您需要在 docs/.vuepress/config.js 中设置正确的基数。 假设您的存储库位于 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/" - 您需要将 /xxxxxGuide/ 设置为基础。

这就是我的 config.js 的样子 :

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