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

web deployment-将 VuePress 部署到 GitHub 页面

(web deployment - Deploy VuePress to GitHub pages)

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

尝试部署此文档:

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

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

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

这是本地开发中的外观:

这是本地开发中的外观

这是 GithHub 的外观:

这是 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',
                ]
            },
        ]
    }
}

包.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"
  }
}

并部署.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,我已经按照部署到 Github 的步骤进行了操作:https : //vuepress.vuejs.org/guide/deploy.html#github-pages

我究竟做错了什么?

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

有一个类似的问题。你需要在 docs/.vuepress/config.js 中设置正确的基础。假设你的存储库位于https://github.com/[USERNAME]/[REPO],那么你需要将 base 设置为“/[REPO]/”。换句话说,当你转到“设置”>“页面”并看到一条消息:“你的网站已发布在https://xxxxxx77.github.io/xxxxxGuide/” - 你需要将 /xxxxxGuide/ 设置为你的基础。

这是我的 config.js 的样子:

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