HUGO

Ignore files in data/ that aren't yaml, json, toml, or csv

I am building a site for a client that is generating content from an OpenAPI specification (YAML). I have created a separate build process that generates the necessary markdown files in content/ based on this spec, but I would like to use the spec files themselves to generate the final HTML.

To this end I’ve pulled the spec into the data directory as a git submodule. Works great for generating the necessary markdown files, but fails on the Hugo build because Hugo attempts to read in the non-data oriented files from the repo in data/ (README.md, for example).

I began under the impression that Hugo would simply ignore files that don’t have the .yml, .yaml, .json, or .csv file extensions but apparently it’s greedy and wants to process all of these files.

Is there a way to ask Hugo to ignore these files? I would like to avoid any shenanigans and keep this as clean as possible, but it’s looking like shenanigans.

Not to my knowledge. What I do is working with subfolders and mount subfolders that contain only the required folders. Not data but data/myspecs.

1 Like

Yes there is. See ignoreFiles

2 Likes

Just to go 100% sure: “content files” in that docs page means also files in the data directory?

That’s what I thought when I read that too, but I guess I should have just tried it. It will ignore files in the data directory as well, confirmed moments ago.

Yes the doc should omit the word content files.

I’ve been using ignoreFiles for ages and it does ignore files under /data/

1 Like

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