首页 > 解决方案 > 从 Github 构建 Firebase/Hugo 成功,但网站上出现索引错误

问题描述

构建一个 Firebase/Hugo 静态网站,在 Github 存储库更改时更新。

我正在使用快速入门指南中的标准主题:https ://gohugo.io/getting-started/quick-start/

该网页在本地运行良好。

hugo server -D

当我将构建部署到 Firebase 时,该网页运行良好。

firebase deploy --only hosting

当我从 Github 存储库触发构建时,该网页无法正常运行,尽管 Google Cloud Build 表示成功。

访问 URL 的结果是以下消息:

Page Not Found

This file does not exist and there was no index.html found in the current directory or 404.html in the root directory.

Why am I seeing this?

You may have deployed the wrong directory for your application. Check your firebase.json and make sure the public directory is pointing to a directory that contains an index.html file.

You can also add a 404.html in the root of your site to replace this page with a custom error page.

我尝试将 config.toml 中的“baseURL”更改为自定义域、firebase 域和 Github 存储库 URL。没有什么。

在此处链接到 Github 存储库。

4/16 更新:如果我不在.gitignore 中包含公用文件夹,它可以工作

标签: gitfirebasegoogle-cloud-platformhugogoogle-cloud-build

解决方案


您完成CI 设置了吗?


推荐阅读