Ok, I’m starting to understand Hugo, somewhat… But I’ve run into a need to generate an HTML table from a locally-stored file, and insert that into a page. I’m using the hugo learn template because it just works for what I need.
I understand that generating an HTML table from a data file requires using a partial (which is called from an HTML page), but I’m not clear on how (or if) I can control that through markdown. Basically, my hope was to be able to create an .md file that would somehow display that HTML table partial…
My only other option would be to build the tables programmatically in a perl script and save them as a markdown page in the appropriate content folder… Not something I’d prefer to do.
I opted to convert it to a CSV format, using the example outlined on the Data Files page, but for some reason, the argument isn’t passed to the partial.
In my md file, I have the line:
{{<table "cpu.csv">}}
and in the partial (table.html), I currently have:
That should display a header with the dataFile argument that was passed form the markdown. Unfortunately, it’s blank… Not sure why the argument isn’t getting passed (or perhaps not persisting?)
Right, but it’s a CSV, and Hugo server spits out all sorts of errors. Besides, the documentation said not to put CSV files in /data… unless I missed something…
Also, the argument should still contain the string, right? It should only fail if I tried to actually open it.