I am using Hugo to make an online catalog of sorts, all my products need lots of tables to explain the available variations, types, models, sizes…
So how I go making my single-page template for products load some json file related to the product name or folder and display it as table?
I want to know if I can do something similar to the “bundles”, and put json file either in the content folder or in a data folder with same structure and have refer to it as something like “.This.Data” or something instead of figuring how to build the whole path to the data folder to get the file.
Yep, it’s possible. Since the JSON file would live inside a page bundle, instead of referring to it with site.Data.foo you would get the file as a page bundle resource then use its .Content
Thanks! It worked! No idea why though… I did some searching on the forums since my last post and found another post with similar question, and the code was almost identical, but didn’t work, most notable using only “.Get” would give funky errors.
Also lots of errors about unknown type and whatnot.
While debugging I reached a code almost identical as your example, but using your example working, while my code didn’t, and only difference as far as I know is using two lines instead of one to open the resource file…