Issue with Hugo site links after deploying to Netlify

I tried to host my Hugo site on Netlify and successfully deployed it. However, the links on the site are not working correctly. For example:

  • If I click the site title, it redirects to localhost.

  • If I click a menu item, it also goes to localhost.

The code is hosted on GitHub and deployed on Netlify. Here are the links:

Hugo configuration (config.yaml) looks like this:

baseURL: “https://ifewsteps.netlify.app/”
title: ExampleSite
theme: PaperMod

enableRobotsTXT: true
buildDrafts: false
buildFuture: false
buildExpired: false

minify:
disableXML: true
minifyOutput: true

Menu configuration

menu:
main:
- name: Home
url: /
weight: 1
- name: Udemy Coupons
url: /udemy-coupon/
weight: 2

Updated Hugo v0.152 pagination config

pagination:
pagerSize: 10

Disable unused kinds

disableKinds:

“taxonomy”

“term” # this replaces taxonomyTerm

Can anybody tell me where I might be making a naming or URL error?

1) Edit the .gitignore file in the root of your project. It should look something like this:

.DS_Store
.hugo_build.lock
hugo_stats.json
node_modules/
public/
resources/

2) Remove the public directory (and other cruft) from source control and push changes:

git rm -rf public/
git rm .hugo_build.lock
git rm .DS_Store
git add -A && git commit -m "Cleanup repo" && git push
1 Like

I already have a .gitignore file. Do I need to remove everything in it and only use the lines you suggested, or can I just add the new lines to my existing file? Thx.

my gitignore file looks like:

# Hugo generated files

/public/

/resources/_gen/

/hugo_cache/

*.html




# Hugo temporary files

*.lock

*.log




# OS-specific files

.DS_Store

Thumbs.db




# Node.js (if using npm or yarn for theme assets)

node_modules/

package-lock.json

yarn.lock




# Sass cache (if using SCSS)

.sass-cache/




# IDE/editor folders

.vscode/

.idea/




# Netlify specific (optional)

.netlify/




# Backup files

*.bak

*.tmp

*.swp

Compare my entries with yours, and add any that are missing.

i just added only those which you gave me and pushed. now getting error 404 after deploy :frowning:

You have set the draft status of the home page to true. Don’t do that.

1 Like

thanks for pointing. i changed it. but now the project stopped as i got mail form netlify (Your credit usage on team FewSteps has exceeded your 300 credit allowance in the current billing cycle from November 6 to December 5.).

thanks for helping. hopefully, it will be fixed. Is there any other alternative option where i can test after deplyo freely? form last night i was tring to fix only that issue and it ate all my 300 credits. :frowning:

Host it somewhere else temporarily?

I mean something like Netlify. I know Google Firebase Hosting also offers free hosting, but I’m not sure if it works the same way. Specifically, I mean whether it can automatically deploy whenever I commit, like Netlify does.

See our documentation for CI/CD setups:
https://gohugo.io/host-and-deploy/

If this is something temporary until you sort out your Netlify billing, GitHub Pages is a no-brainer, but you would need to rework form handling.

ok. thanks

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