Site built locally with `hugo serve` looks fine, but there are problems on netlify

Hi, I have a Hugo site deployed on Netlify. I have been making changes & commiting them from past few days. I observed only today that the deployed site is not same as that of local site. The build log shows no error. The repo is on GitLab (but not open source). I am using the same version 0.86.0 both for dev & prod (on Netlify). I very well understand that the problem might not be on Hugo side.

My dev machine logs

πŸš€  hugo serve
Start building sites … 
hugo v0.86.0-41C6C52E+extended windows/amd64 BuildDate=2021-07-21T09:53:14Z VendorInfo=gohugoio

                   | EN   
-------------------+------
  Pages            |  19  
  Paginator pages  |   2  
  Non-page files   |   0  
  Static files     | 247  
  Processed images |  27  
  Aliases          |   1  
  Sitemaps         |   1  
  Cleaned          |   0  

Netlify build log

5:00:18 PM: Build ready to start
5:00:20 PM: build-image version: 122b31996ccaffd45d820a452d6227f8312110cc (focal)
5:00:20 PM: build-image tag: v4.5.3
5:00:20 PM: buildbot version: 398bd8f0cf7c89ede5175bf64d57dd805e2eab84
5:00:20 PM: Building without cache
5:00:20 PM: Starting to prepare the repo for build
5:00:21 PM: No cached dependencies found. Cloning fresh repo
5:00:21 PM: git clone git@gitlab.com:/**my repo**
5:00:22 PM: Preparing Git Reference refs/heads/main
5:00:23 PM: Parsing package.json dependencies
5:00:24 PM: Starting build script
5:00:24 PM: Installing dependencies
5:00:24 PM: Python version set to 2.7
5:00:25 PM: v16.13.2 is already installed.
5:00:26 PM: Now using node v16.13.2 (npm v8.1.2)
5:00:26 PM: Started restoring cached build plugins
5:00:26 PM: Finished restoring cached build plugins
5:00:26 PM: Attempting ruby version 2.7.2, read from environment
5:00:28 PM: Using ruby version 2.7.2
5:00:28 PM: Using PHP version 8.0
5:00:28 PM: Installing Hugo 0.86.0
5:00:30 PM: hugo v0.86.0-41C6C52E+extended linux/amd64 BuildDate=2021-07-21T09:53:14Z VendorInfo=gohugoio
5:00:30 PM: Started restoring cached go cache
5:00:30 PM: Finished restoring cached go cache
5:00:30 PM: go version go1.16.5 linux/amd64
5:00:30 PM: go version go1.16.5 linux/amd64
5:00:30 PM: Installing missing commands
5:00:30 PM: Verify run directory
5:00:32 PM: ​
5:00:32 PM: ────────────────────────────────────────────────────────────────
5:00:32 PM:   Netlify Build                                                 
5:00:32 PM: ────────────────────────────────────────────────────────────────
5:00:32 PM: ​
5:00:32 PM: ❯ Version
5:00:32 PM:   @netlify/build 26.2.3
5:00:32 PM: ​
5:00:32 PM: ❯ Flags
5:00:32 PM:   baseRelDir: true
5:00:32 PM:   buildId: 61fd0e4a03e7d0ab1645a0dd
5:00:32 PM:   deployId: 61fd0e4a03e7d0ab1645a0df
5:00:32 PM: ​
5:00:32 PM: ❯ Current directory
5:00:32 PM:   /opt/build/repo
5:00:32 PM: ​
5:00:32 PM: ❯ Config file
5:00:32 PM:   No config file was defined: using default values.
5:00:32 PM: ​
5:00:32 PM: ❯ Context
5:00:32 PM:   production
5:00:32 PM: ​
5:00:32 PM: ────────────────────────────────────────────────────────────────
5:00:32 PM:   1. Build command from Netlify app                             
5:00:32 PM: ────────────────────────────────────────────────────────────────
5:00:32 PM: ​
5:00:32 PM: $ hugo
5:00:32 PM: Start building sites …
5:00:32 PM: hugo v0.86.0-41C6C52E+extended linux/amd64 BuildDate=2021-07-21T09:53:14Z VendorInfo=gohugoio
5:00:32 PM:                    | EN
5:00:32 PM: -------------------+------
5:00:32 PM:   Pages            |  19
5:00:32 PM:   Paginator pages  |   2
5:00:32 PM:   Non-page files   |   0
5:00:32 PM:   Static files     | 247
5:00:32 PM:   Processed images |  22
5:00:32 PM:   Aliases          |   1
5:00:32 PM:   Sitemaps         |   1
5:00:32 PM:   Cleaned          |   0
5:00:32 PM: Total in 165 ms
5:00:32 PM: ​
5:00:32 PM: (build.command completed in 240ms)
5:00:32 PM: ​
5:00:32 PM: ────────────────────────────────────────────────────────────────
5:00:32 PM:   2. Deploy site                                                
5:00:32 PM: ────────────────────────────────────────────────────────────────
5:00:32 PM: ​
5:00:32 PM: Starting to deploy site from 'public'
5:00:32 PM: Creating deploy tree 
5:00:32 PM: Creating deploy upload records
5:00:32 PM: 12 new files to upload
5:00:32 PM: 0 new functions to upload
5:00:33 PM: Site deploy was successfully initiated
5:00:33 PM: ​
5:00:33 PM: (Deploy site completed in 893ms)
5:00:33 PM: ​
5:00:33 PM: ────────────────────────────────────────────────────────────────
5:00:33 PM:   Netlify Build Complete                                        
5:00:33 PM: ────────────────────────────────────────────────────────────────
5:00:33 PM: ​
5:00:33 PM: (Netlify Build completed in 1.2s)
5:00:33 PM: Starting post processing
5:00:33 PM: Post processing - HTML
5:00:33 PM: Caching artifacts
5:00:33 PM: Started saving build plugins
5:00:33 PM: Finished saving build plugins
5:00:33 PM: Started saving pip cache
5:00:33 PM: Finished saving pip cache
5:00:33 PM: Started saving emacs cask dependencies
5:00:33 PM: Finished saving emacs cask dependencies
5:00:33 PM: Started saving maven dependencies
5:00:33 PM: Finished saving maven dependencies
5:00:33 PM: Started saving boot dependencies
5:00:33 PM: Finished saving boot dependencies
5:00:33 PM: Started saving rust rustup cache
5:00:33 PM: Finished saving rust rustup cache
5:00:33 PM: Started saving go dependencies
5:00:33 PM: Finished saving go dependencies
5:00:34 PM: Post processing - header rules
5:00:34 PM: Post processing - redirect rules
5:00:34 PM: Post processing done
5:00:35 PM: Build script success
5:00:36 PM: Site is live ✨
5:00:52 PM: Finished processing build request in 32.537958743s

I even triggered a deploy with β€˜clear cache’ option. But no result.

P.S: there is nothing in my codebase where Hugo has to do different things for dev & prod. So, I think they both should be same. Also, everything was working fine until 2 days ago.

Changing the baseURL to / solved the problem.

Good on you for solving the problem but the baseURL needs to be set to the domain that is going to be used for publishing the project.

Thanks for pitching in @alexandros . You are correct. I’m completely aware of that.

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