https://gohugo.io/getting-started/usage/#build-your-site
Hugo does not clear the
public
directory before building your site. Existing files are overwritten, but not deleted. This behavior is intentional to prevent the inadvertent removal of files that you may have added to thepublic
directory after the build.Depending on your needs, you may wish to manually clear the contents of the public directory before every build.
If you need further assistance, please post a link to the public repository for your project.
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 runhugo 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.