Search code examples
hugonetlifynetlify-cms

Page not found with hugo on netlify


I recently translated a site I wrote myself to hugo so I am not using a theme, I tested it on localhost and it ran perfectly, however, when trying to host it on netlify I get a page not found error. I have set the publish directory to public both on the netlify.toml file and on netlify's continuous deployment settings like this:

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"

and: Netlify's config

I think I have followed every guide there is out there and nothing seems to work.

Here is the link to my repo on github https://github.com/guidogr95/amazondigital

Also the last deployment log:

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

When I download the deployment files I notice there is no index.html, its only these files:

Deployment files

I tried using the "hugo" command in my local environment and uploading the public folder that was created, doing that the site is displayed but that is not the proper way to do it, also I wanna use netlify cms and with that method it wouldn't work. Please, any help will be much appreciated, thanks in advance


Solution

  • The issue here is a matter of casing on filenames. Windows ignores casing in some cases and will resolve a path for a file with an uppercase when it should be a lower case. The build environment on Netlify is using unix in this case, so Hugo does not see the template baseof.html.

    Change /layouts/_default/baseOf.html to all lowercase /layouts/_default/baseof.html