I’m setting up a Hugo site with with the timer-hugo theme (I hope my problem is not related to the theme). I have a csv file stored in the static directory (not in data, because I want to access a csv from a user-defined path set by .Params.tlarData in the content markdowns)
Failed to get CSV resource " … /tlar.csv": Get " … /tlar.csv": dial tcp 127.0.0.1:1313: connect: connection refused.
Setting ignoreErrors = "error-remote-getcsv" solves the issue for localhost, but not when I’m publishing the website on a real server (GitLab pages in my case).
WithIn the local file system of a Hugo project I was not able to use geCSV outside the dataDir or the assetDir. Not from static as the OP posted. Unless something has changed in the past year or so.
You can’t use getCSV to access data within the data or assets directories either.
You can’t use getCSV to access data anywhere on the local file system.
Although getCSV works with a file in the data directory, don’t put it there. It will cause an error as soon as you try access a supported data file (JSON, TOML, YAML) with site.Data.foo.
Having said that, for many cases I think it’s easier to include the CSV file in a page bundle, and get it with .Resources.GetMatch as described earlier.