Netlify is not deploying my site correctly with Hugo

Hey!
I have recently added Hugo to a site that was already built. What I mean by built is: purchased domain, html files written, repo on github created and published via Netlify. It was originally planned to by very simple and using Hugo would be an overkill but since the site got more and more complex, I decided to add Hugo at the end. So I added Hugo and the website cannot be visited. I don’t exactly know where the problem could be. On my localhost link, I see the site and I can edit it, but when I publish the changes on github, suddenly I see nothing when I visit the site, just a “Page Not Found” error. Any help?

Please help us to help you.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Sorry, here it is: GitHub - pgersl/astropi-hackathon-website

Please post the Netlify build log as well, thanks.

This is the latest log

8:09:28 PM: build-image version: d7b3813f01c06610bc1723ff1b22446513ee7941 (focal)
8:09:28 PM: build-image tag: v4.14.3
8:09:28 PM: buildbot version: f2613f2234a773b4fab58b5a3c03c743fe78f9bf
8:09:28 PM: Fetching cached dependencies
8:09:28 PM: Starting to download cache of 994.9KB
8:09:28 PM: Finished downloading cache in 128.357795ms
8:09:28 PM: Starting to extract cache
8:09:28 PM: Finished extracting cache in 5.579685ms
8:09:28 PM: Finished fetching cache in 157.079554ms
8:09:28 PM: Starting to prepare the repo for build
8:09:28 PM: Preparing Git Reference refs/heads/main
8:09:28 PM: Parsing package.json dependencies
8:09:29 PM: Starting build script
8:09:29 PM: Installing dependencies
8:09:29 PM: Python version set to 2.7
8:09:30 PM: v16.18.0 is already installed.
8:09:30 PM: Now using node v16.18.0 (npm v8.19.2)
8:09:30 PM: Enabling node corepack
8:09:30 PM: Started restoring cached build plugins
8:09:30 PM: Finished restoring cached build plugins
8:09:30 PM: Attempting ruby version 2.7.2, read from environment
8:09:31 PM: Using ruby version 2.7.2
8:09:31 PM: Using PHP version 8.0
8:09:31 PM: Started restoring cached go cache
8:09:31 PM: Finished restoring cached go cache
8:09:31 PM: Installing Go version 1.17 (requested 1.17)
8:09:35 PM: unset GOOS;
8:09:35 PM: unset GOARCH;
8:09:35 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
8:09:35 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
8:09:35 PM: go version >&2;
8:09:35 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
8:09:35 PM: go version go1.17 linux/amd64
8:09:35 PM: Installing missing commands
8:09:35 PM: Verify run directory
8:09:37 PM: ​
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:37 PM:   Netlify Build                                                 
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:37 PM: ​
8:09:37 PM: Creating deploy upload records
8:09:37 PM: ❯ Version
8:09:37 PM:   @netlify/build 28.1.4
8:09:37 PM: ​
8:09:37 PM: ❯ Flags
8:09:37 PM:   baseRelDir: true
8:09:37 PM:   buildId: 635ecbda043bc47b60e3789f
8:09:37 PM:   deployId: 635ecbda043bc47b60e378a1
8:09:37 PM: ​
8:09:37 PM: ❯ Current directory
8:09:37 PM:   /opt/build/repo
8:09:37 PM: ​
8:09:37 PM: Starting post processing
8:09:37 PM: ❯ Config file
8:09:37 PM:   No config file was defined: using default values.
8:09:37 PM: ​
8:09:37 PM: Post processing - HTML
8:09:37 PM: ❯ Context
8:09:37 PM:   production
8:09:37 PM: ​
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:38 PM: Post processing - header rules
8:09:37 PM:   1. Build command from Netlify app                             
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:37 PM: ​
8:09:37 PM: $ hugo
8:09:38 PM: Post processing - redirect rules
8:09:37 PM: Start building sites …
8:09:37 PM: hugo v0.85.0-724D5DB5+extended linux/amd64 BuildDate=2021-07-05T10:46:28Z VendorInfo=gohugoio
8:09:37 PM: WARN 2022/10/30 19:09:37 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
8:09:38 PM: Post processing done
8:09:37 PM: WARN 2022/10/30 19:09:37 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
8:09:37 PM:                    | EN
8:09:37 PM: -------------------+-----
8:09:37 PM:   Pages            |  4
8:09:37 PM:   Paginator pages  |  0
8:09:37 PM:   Non-page files   |  0
8:09:37 PM:   Static files     |  6
8:09:37 PM:   Processed images |  0
8:09:37 PM:   Aliases          |  0
8:09:37 PM:   Sitemaps         |  1
8:09:37 PM:   Cleaned          |  0
8:09:37 PM: Total in 20 ms
8:09:37 PM: ​
8:09:37 PM: (build.command completed in 52ms)
8:09:37 PM: ​
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:37 PM:   2. Deploy site                                                
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:37 PM: ​
8:09:37 PM: Starting to deploy site from ''
8:09:37 PM: Creating deploy tree 
8:09:37 PM: 5 new files to upload
8:09:37 PM: 0 new functions to upload
8:09:37 PM: Site deploy was successfully initiated
8:09:37 PM: ​
8:09:37 PM: (Deploy site completed in 347ms)
8:09:37 PM: ​
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:37 PM:   Netlify Build Complete                                        
8:09:37 PM: ────────────────────────────────────────────────────────────────
8:09:37 PM: ​
8:09:37 PM: (Netlify Build completed in 451ms)
8:09:38 PM: Caching artifacts
8:09:38 PM: Started saving build plugins
8:09:38 PM: Finished saving build plugins
8:09:38 PM: Started saving pip cache
8:09:38 PM: Finished saving pip cache
8:09:38 PM: Started saving emacs cask dependencies
8:09:38 PM: Finished saving emacs cask dependencies
8:09:38 PM: Started saving maven dependencies
8:09:38 PM: Finished saving maven dependencies
8:09:38 PM: Started saving boot dependencies
8:09:38 PM: Finished saving boot dependencies
8:09:38 PM: Started saving rust rustup cache
8:09:38 PM: Finished saving rust rustup cache
8:09:38 PM: Started saving go dependencies
8:09:38 PM: Finished saving go dependencies
8:09:39 PM: Build script success
8:09:39 PM: Uploading Cache of size 65.9MB
8:09:40 PM: Finished processing build request in 12.201984423s
8:09:40 PM: Site is live ✨

In your Netlify log I see:

8:09:37 PM: Starting to deploy site from ''

I would expect to see something like:

8:09:37 PM: Starting to deploy site from 'public'

I suggest you raise an issue here:
https://answers.netlify.com/c/netlify-support/48

Thank you so much for your replies. Check the repo now, I’ve added a netlify.toml file with just two settings:

[context.production.environment]
TZ = "Europe/Prague"

[build]
publish = "public"

and it works fine now. It’s weird, I’ve never encountered such issue but it’s great I now know ho to fix it. Thank you for your time!

Try to add version of Hugo as well to your Netlify file like

[build]
 publish = "public"
 command = "hugo --gc --minify"

[context.production.environment]
 HUGO_VERSION = "0.105.0"
 HUGO_ENV = "production"
 HUGO_ENABLEGITINFO = "false"

Thanks for the suggestion!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.