Issues Deploying From Git (Hugo Site With Two Themes)

Hey Guys,

This is my first post in the community so I’ll try my best to be as specific as I can but let me know if you need more info, I truly appreciate any help.

I’m having issues with deploying my hugo site (since I set up two hugo themes) to netlify.

I am using git to deploy my site, it worked correctly until I configured my hugo site to have two themes.

The exact set up I use to create two hugo themes can be found here for a question I asked on the hugo community:

Now when I deploy my website through git, netlify seems to be building my hugo site from the content directory and not using the public directory.

The two theme set up is generated into the public directory. Which build my subpage “/notes” with another theme.

The only time I got it to work in netlify is by instead of deploying through git, I use the drag and drop function to upload the public directory. (this works, but sometimes the css of the 2nd theme breaks)

this is a website example with drag and drop where the css of the /notes sub page is broken, but at least it read it’s as a separate theme from the main one:

https://santi-test-2.netlify.app/
notes sub-folder (secondary theme)
https://santi-test-2.netlify.app/notes/

Now when I deploy using git, the public directory seems to be ignored

https://santi-test-1.netlify.app/
notes sub folder (secondary theme doesn’t work at all)
https://santi-test-1.netlify.app/notes/

I’m suspecting there something in netlify.toml that needs to be configured to fix this issue.

All I need is for netlify to build the site from the public directory, when using git to deploy.

My netlify.toml is a copy paste from the hugo instructions to host with netlify.

Here’s my repository in github to see if there’s anything else that might be causing conflicts:

I really appreciate any kind of help. I’ve been stuck with this for a couple of weeks trying to find answers in docs and I don’t know what is causing this error.

Thank you!

Hey there! Currently after hours for me right now but I didn’t want to leave you without an answer.

I’ve browsed to your demo sites and I don’t see an issue! :open_mouth: Have you managed to resolve this? Otherwise, can you provide a build log for the two theme sites?

Hey @Scott thank you so much. I don’t want to take much of your time so I’ll be as concise as possible.

I just realized I might have accidently messed up this sample links while testing things.

The github repo link changed, so I moved the test one I used for this gitlab repo here
https://gitlab.com/santiyounger/santi-website-netlify-test

The other links above to my test sites should work now.

The problem is that this section:

notes sub folder (secondary theme doesn’t work at all)
https://santi-test-1.netlify.app/notes/

Should look like this one:

notes sub-folder (secondary theme)

https://santi-test-2.netlify.app/notes/
Side note: the css sometimes breaks, once I fix this, it should look like this example using this theme

The Main Problem

Netlify doesn’t seem to consider my public directory when deploying with git, since I’m using config-notes.toml to export the /notes subpage of my site to be built with a secondary theme.

then I build it all to the hugo public directory, it work when dragging and droppin the “public directory” to netlify, but netlify doesn’t read the secondary theme when deployed with git, it seems to ignore the public directory.

my guess is I must have something missing in my netlify.toml

Deploy Log

I’ll attach here netlify’s deploy log. (I’m sorry, I’m not sure if this is what you asked for when you said “build log” let me know if you need something else)

Santi test 1 Deploy Log (Build From Gitlab)

Summary

5:46:05 PM: Build ready to start
5:46:06 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
5:46:06 PM: build-image tag: v3.4.1
5:46:06 PM: buildbot version: e1f4178b0d9779ebad1b11d5b54739f82fed3c22
5:46:07 PM: Fetching cached dependencies
5:46:07 PM: Starting to download cache of 99.0MB
5:46:09 PM: Finished downloading cache in 2.049797014s
5:46:09 PM: Starting to extract cache
5:46:12 PM: Finished extracting cache in 3.543649114s
5:46:12 PM: Finished fetching cache in 5.628136832s
5:46:12 PM: Starting to prepare the repo for build
5:46:13 PM: Preparing Git Reference refs/heads/master
5:46:15 PM: Starting build script
5:46:15 PM: Installing dependencies
5:46:15 PM: Python version set to 2.7
5:46:15 PM: Started restoring cached node version
5:46:18 PM: Finished restoring cached node version
5:46:19 PM: v12.18.0 is already installed.
5:46:20 PM: Now using node v12.18.0 (npm v6.14.4)
5:46:20 PM: Started restoring cached build plugins
5:46:20 PM: Finished restoring cached build plugins
5:46:20 PM: Attempting ruby version 2.7.1, read from environment
5:46:22 PM: Using ruby version 2.7.1
5:46:22 PM: Using PHP version 5.6
5:46:22 PM: 5.2 is already installed.
5:46:22 PM: Using Swift version 5.2
5:46:22 PM: Installing Hugo 0.74.3
5:46:23 PM: Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z
5:46:23 PM: Started restoring cached go cache
5:46:23 PM: Finished restoring cached go cache
5:46:23 PM: go version go1.14.4 linux/amd64
5:46:23 PM: go version go1.14.4 linux/amd64
5:46:23 PM: Installing missing commands
5:46:23 PM: Verify run directory
5:46:24 PM: ​
5:46:24 PM: ┌─────────────────────────────┐
5:46:24 PM: │ Netlify Build │
5:46:24 PM: └─────────────────────────────┘
5:46:24 PM: ​
5:46:24 PM: ❯ Version
5:46:24 PM: @netlify/build 3.3.5
5:46:24 PM: ​
5:46:24 PM: ❯ Flags
5:46:24 PM: deployId: 5f54152c213d7800076c4ddd
5:46:24 PM: mode: buildbot
5:46:24 PM: ​
5:46:24 PM: ❯ Current directory
5:46:24 PM: /opt/build/repo
5:46:24 PM: ​
5:46:24 PM: ❯ Config file
5:46:24 PM: /opt/build/repo/netlify.toml
5:46:24 PM: ​
5:46:24 PM: ❯ Context
5:46:24 PM: production
5:46:24 PM: ​
5:46:24 PM: ┌────────────────────────────────────┐
5:46:24 PM: │ 1. build.command from netlify.toml │
5:46:24 PM: └────────────────────────────────────┘
5:46:24 PM: ​
5:46:24 PM: $ hugo --gc --minify
5:46:26 PM: Building sites …
5:46:26 PM: | EN
5:46:26 PM: -------------------±-----
5:46:26 PM: Pages | 156
5:46:26 PM: Paginator pages | 69
5:46:26 PM: Non-page files | 0
5:46:26 PM: Static files | 0
5:46:26 PM: Processed images | 0
5:46:26 PM: Aliases | 11
5:46:26 PM: Sitemaps | 1
5:46:26 PM: Cleaned | 2
5:46:26 PM: Total in 1366 ms
5:46:26 PM: ​
5:46:26 PM: (build.command completed in 1.5s)
5:46:26 PM: ​
5:46:26 PM: ┌─────────────────────────────┐
5:46:26 PM: │ Netlify Build Complete │
5:46:26 PM: └─────────────────────────────┘
5:46:26 PM: ​
5:46:26 PM: (Netlify Build completed in 1.5s)
5:46:26 PM: Caching artifacts
5:46:26 PM: Started saving build plugins
5:46:26 PM: Finished saving build plugins
5:46:26 PM: Started saving pip cache
5:46:26 PM: Finished saving pip cache
5:46:26 PM: Started saving emacs cask dependencies
5:46:26 PM: Finished saving emacs cask dependencies
5:46:26 PM: Started saving maven dependencies
5:46:26 PM: Finished saving maven dependencies
5:46:26 PM: Started savin 5:46:05 PM: Build ready to start
5:46:06 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
5:46:06 PM: build-image tag: v3.4.1
5:46:06 PM: buildbot version: e1f4178b0d9779ebad1b11d5b54739f82fed3c22
5:46:07 PM: Fetching cached dependencies
5:46:07 PM: Starting to download cache of 99.0MB
5:46:09 PM: Finished downloading cache in 2.049797014s
5:46:09 PM: Starting to extract cache
5:46:12 PM: Finished extracting cache in 3.543649114s
5:46:12 PM: Finished fetching cache in 5.628136832s
5:46:12 PM: Starting to prepare the repo for build
5:46:13 PM: Preparing Git Reference refs/heads/master
5:46:15 PM: Starting build script
5:46:15 PM: Installing dependencies
5:46:15 PM: Python version set to 2.7
5:46:15 PM: Started restoring cached node version
5:46:18 PM: Finished restoring cached node version
5:46:19 PM: v12.18.0 is already installed.
5:46:20 PM: Now using node v12.18.0 (npm v6.14.4)
5:46:20 PM: Started restoring cached build plugins
5:46:20 PM: Finished restoring cached build plugins
5:46:20 PM: Attempting ruby version 2.7.1, read from environment
5:46:22 PM: Using ruby version 2.7.1
5:46:22 PM: Using PHP version 5.6
5:46:22 PM: 5.2 is already installed.
5:46:22 PM: Using Swift version 5.2
5:46:22 PM: Installing Hugo 0.74.3
5:46:23 PM: Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z
5:46:23 PM: Started restoring cached go cache
5:46:23 PM: Finished restoring cached go cache
5:46:23 PM: go version go1.14.4 linux/amd64
5:46:23 PM: go version go1.14.4 linux/amd64
5:46:23 PM: Installing missing commands
5:46:23 PM: Verify run directory
5:46:24 PM: ​
5:46:24 PM: ┌─────────────────────────────┐
5:46:24 PM: │ Netlify Build │
5:46:24 PM: └─────────────────────────────┘
5:46:24 PM: ​
5:46:24 PM: ❯ Version
5:46:24 PM: @netlify/build 3.3.5
5:46:24 PM: ​
5:46:24 PM: ❯ Flags
5:46:24 PM: deployId: 5f54152c213d7800076c4ddd
5:46:24 PM: mode: buildbot
5:46:24 PM: ​
5:46:24 PM: ❯ Current directory
5:46:24 PM: /opt/build/repo
5:46:24 PM: ​
5:46:24 PM: ❯ Config file
5:46:24 PM: /opt/build/repo/netlify.toml
5:46:24 PM: ​
5:46:24 PM: ❯ Context
5:46:24 PM: production
5:46:24 PM: ​
5:46:24 PM: ┌────────────────────────────────────┐
5:46:24 PM: │ 1. build.command from netlify.toml │
5:46:24 PM: └────────────────────────────────────┘
5:46:24 PM: ​
5:46:24 PM: $ hugo --gc --minify
5:46:26 PM: Building sites …
5:46:26 PM: | EN
5:46:26 PM: -------------------±-----
5:46:26 PM: Pages | 156
5:46:26 PM: Paginator pages | 69
5:46:26 PM: Non-page files | 0
5:46:26 PM: Static files | 0
5:46:26 PM: Processed images | 0
5:46:26 PM: Aliases | 11
5:46:26 PM: Sitemaps | 1
5:46:26 PM: Cleaned | 2
5:46:26 PM: Total in 1366 ms
5:46:26 PM: ​
5:46:26 PM: (build.command completed in 1.5s)
5:46:26 PM: ​
5:46:26 PM: ┌─────────────────────────────┐
5:46:26 PM: │ Netlify Build Complete │
5:46:26 PM: └─────────────────────────────┘
5:46:26 PM: ​
5:46:26 PM: (Netlify Build completed in 1.5s)
5:46:26 PM: Caching artifacts
5:46:26 PM: Started saving build plugins
5:46:26 PM: Finished saving build plugins
5:46:26 PM: Started saving pip cache
5:46:26 PM: Finished saving pip cache
5:46:26 PM: Started saving emacs cask dependencies
5:46:26 PM: Finished saving emacs cask dependencies
5:46:26 PM: Started saving maven dependencies
5:46:26 PM: Finished saving maven dependencies
5:46:26 PM: Started saving boot dependencies
5:46:26 PM: Finished saving boot dependencies
5:46:26 PM: Started saving go dependencies
5:46:26 PM: Finished saving go dependencies
5:46:26 PM: Build script success
5:46:26 PM: Starting to deploy site from ‘public’
5:46:26 PM: Creating deploy tree
5:46:26 PM: Creating deploy upload records
5:46:26 PM: 126 new files to upload
5:46:26 PM: 0 new functions to upload
5:46:29 PM: Starting post processing
5:46:29 PM: Post processing - HTML
5:46:39 PM: Post processing - header rules
5:46:39 PM: Post processing - redirect rules
5:46:39 PM: Post processing done
5:46:39 PM: Site is live
5:46:44 PM: Finished processing build request in 37.948433705sg boot dependencies
5:46:26 PM: Finished saving boot dependencies
5:46:26 PM: Started saving go dependencies
5:46:26 PM: Finished saving go dependencies
5:46:26 PM: Build script success
5:46:26 PM: Starting to deploy site from ‘public’
5:46:26 PM: Creating deploy tree
5:46:26 PM: Creating deploy upload records
5:46:26 PM: 126 new files to upload
5:46:26 PM: 0 new functions to upload
5:46:29 PM: Starting post processing
5:46:29 PM: Post processing - HTML
5:46:39 PM: Post processing - header rules
5:46:39 PM: Post processing - redirect rules
5:46:39 PM: Post processing done
5:46:39 PM: Site is live
5:46:44 PM: Finished processing build request in 37.948433705s

Santi Test 2 Deploy Log (drag and dropped public directory)

Summary

11:22:23 AM: Creating deploy upload records
11:22:24 AM: Starting post processing
11:22:24 AM: Post processing - HTML
11:22:26 AM: Post processing - header rules
11:22:26 AM: Post processing - redirect rules
11:22:26 AM: Post processing done
11:22:26 AM: Site is live

Alternatives

I’ve been testing a few different things, I might go for the route of having my /notes page separeate into a subdomain to simpify things, and treating it as a separete hugo site completly.


I don’t want to take much of your time, so if the fix isn’t obvious or easy to fix, don’t worry I still appreciate you having taken the time to look at this, thank you @Scott I really appreciate your help!

Hi,

You mentioned that you build notes/ using a separate theme. Does the built files get into your public/ directory? I’m not too familiar with how things are built in Hugo but perhaps the note/ are getting overridden? Or perhaps they aren’t built into the public/ folder directly and you would need to copy it over separately?

Hey @Dennis Thank you for your reply, I will try toubleshooting it by doing manual copies into the public directory, I appreciate your help!

1 Like

let us know how it goes!

Thank you guys, for your kindness. The links above to my test deploys will probably break as I test things. I’ll keep trying thank you for your time!

1 Like