What files and folders does Hugo ignore by default?

hugo v0.152.2+extended linux/amd64 BuildDate=2025-12-14T00:00:00+00:00 VendorInfo=Fedora:0.152.2-1.fc43

Hello, I have just learned a lot with the help of @irkode regarding which files Hugo ignores and does not ignore during a build process, in my post:

To correct the err in my ways, I would now like to learn git and want to start off with a local git repo.

If in my hugo site folder I do “git init” then git creates a folder “.git” in the site folder.

I am concerned that Hugo will parse this .git folder since it is under the site folder.

I have not been able to find info regarding what files and folders Hugo ignores by default (I mean without specifying ignoreFiles and ignoreFiles does not apply to all folders anyways).

I have also asked AI, and AI #1 says that by default Hugo ignores any .file or .folder in any folder of Hugo including eg in /layouts/ and its subfolders.

But AI being AI, AI #2 says Hugo ignores any

_file or _folder

But I doubt that would be correct since Hugo uses eg the _shortcodes folder.

So I would like to ask:

Is using .git folder under a Hugo site folder ok?

Is it correct that Hugo will ignore any .file or .folder in any subfolder of the main site folder? EG if I had .shortcode.html in the _shortcodes folder, would Hugo ignore this?

Is there some docs that describe this default ignore behavior? Sorry but I have not been able to find this.

Thanks ahead of time for any help.

It won’t. And AI #2 is even worse than AI is in general: Hugo does most certainly not ignore _index.md files.

Yes. I guess that the majority of people here use some variant of GitHub, and consequently have a .git folder in their project.

It is not so much about Hugo ignoring something but about using something. And these folders are clearly documented.

2 Likes

@chrillek Thanks for your reply and the info :slight_smile:

Being new to git, I assumed if a developer was using Github as a remote repo then there would be no need for a local .git folder / repo, so I was not sure if a local .git folder was a common thing with Hugo sites.

1 Like