在 netlify 上找不到带有 hugo 的页面

Page not found with hugo on netlify

我最近 t运行 指定了一个我自己写给 hugo 的网站,所以我没有使用主题,我在本地主机上测试了它并且它 运行 完美,但是,当尝试托管它时在 netlify 上,我收到一个找不到页面的错误。我已经在 netlify.toml 文件和 netlify 的持续部署设置中将发布目录设置为 public,如下所示:

netlify.toml,

[build]
publish = "public"
command = "hugo"

[context.production.environment]
HUGO_VERSION = "0.53"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"

[context.split1]
command = "hugo --enableGitInfo"

[context.split1.environment]
HUGO_VERSION = "0.53"
HUGO_ENV = "production"

[context.deploy-preview]
command = "hugo -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]
HUGO_VERSION = "0.53"

[context.branch-deploy]
command = "hugo -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]
HUGO_VERSION = "0.53"

[context.next.environment]
HUGO_ENABLEGITINFO = "true"

和:

我想我已经遵循了所有指南,但似乎没有任何效果。

这是我在 github https://github.com/guidogr95/amazondigital

上的回购 link

也是最后的部署日志:

7:31:10 PM: Build ready to start
7:31:14 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
7:31:14 PM: build-image tag: v3.3.2
7:31:14 PM: buildbot version: 38cc4984170575781fef71bee035f0855939acb8
7:31:15 PM: Fetching cached dependencies
7:31:15 PM: Starting to download cache of 99.9MB
7:31:15 PM: Finished downloading cache in 606.906388ms
7:31:15 PM: Starting to extract cache
7:31:19 PM: Finished extracting cache in 4.22330485s
7:31:20 PM: Finished fetching cache in 4.879888251s
7:31:20 PM: Starting to prepare the repo for build
7:31:20 PM: Preparing Git Reference refs/heads/master
7:31:20 PM: Found netlify.toml. Overriding site configuration
7:31:20 PM: Starting build script
7:31:20 PM: Installing dependencies
7:31:21 PM: Started restoring cached node version
7:31:24 PM: Finished restoring cached node version
7:31:25 PM: v10.16.3 is already installed.
7:31:26 PM: Now using node v10.16.3 (npm v6.9.0)
7:31:26 PM: Attempting ruby version 2.6.2, read from environment
7:31:28 PM: Using ruby version 2.6.2
7:31:28 PM: Using PHP version 5.6
7:31:28 PM: Installing Hugo 0.53
7:31:28 PM: Hugo Static Site Generator v0.53-8FC339DC2529FF77E494A1C12CD1FF9FBCB880A4/extended             
linux/amd64 BuildDate: 2018-12-24T08:38:38Z
7:31:28 PM: Started restoring cached go cache
7:31:28 PM: Finished restoring cached go cache
7:31:28 PM: unset GOOS;
7:31:28 PM: unset GOARCH;
7:31:28 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
7:31:28 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
7:31:28 PM: go version >&2;
7:31:28 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
7:31:28 PM: go version go1.12 linux/amd64
7:31:28 PM: Installing missing commands
7:31:28 PM: Verify run directory
7:31:28 PM: Executing user command: hugo
7:31:28 PM: Building sites …
7:31:29 PM:                    | EN
7:31:29 PM: +------------------+----+
7:31:29 PM: Pages            |  1
7:31:29 PM:   Paginator pages  |  0
7:31:29 PM:   Non-page files   |  0
7:31:29 PM:   Static files
7:31:29 PM:  | 69
7:31:29 PM:   Processed images |  0
7:31:29 PM:   Aliases          |  0
7:31:29 PM:   Sitemaps         |  1
7:31:29 PM:   Cleaned          |  0
7:31:29 PM: Total in 37 ms
7:31:29 PM: Skipping functions preparation step: no functions directory set
7:31:29 PM: Caching artifacts
7:31:29 PM: Started saving pip cache
7:31:29 PM: Finished saving pip cache
7:31:29 PM: Started saving emacs cask dependencies
7:31:29 PM: Finished saving emacs cask dependencies
7:31:29 PM: Started saving maven dependencies
7:31:29 PM: Starting post processing
7:31:29 PM: Finished saving maven dependencies
7:31:29 PM: Started saving boot dependencies
7:31:29 PM: Finished saving boot dependencies
7:31:29 PM: Started saving go dependencies
7:31:29 PM: Finished saving go dependencies
7:31:29 PM: Post processing done
7:31:29 PM: Build script success
7:31:29 PM: Starting to deploy site from 'public'
7:31:29 PM: Creating deploy tree 
7:31:29 PM: 0 new files to upload
7:31:29 PM: 0 new functions to upload
7:31:29 PM: Site is live
7:31:47 PM: Finished processing build request in 32.861294195s

当我下载部署文件时,我注意到没有 index.html,只有这些文件:

我尝试在我的本地环境中使用 "hugo" 命令并上传创建的 public 文件夹,这样做会显示站点,但这不是正确的方法,也我想使用 netlify cms,但使用这种方法是行不通的。 拜托,任何帮助将不胜感激,提前致谢

这里的问题是文件名的大小写问题。 Windows 在某些情况下会忽略大小写,并且会在应该为小写的情况下为大写的文件解析路径。在这种情况下,Netlify 上的构建环境使用的是 unix,因此 Hugo 看不到模板 baseof.html.

/layouts/_default/baseOf.html改为全小写/layouts/_default/baseof.html