First off let me profess my profound gratituide and appreciation for hugo. I’m not a web developer but my experience using hugo has been flawless. I’m just at the point where I can’t find good documentation for what I’m trying to do.
Second, I know my question will probably have a simple answer, I offer my apologies for my lack of brevity in contextualizing my issue
My use case for hugo is to make an ecommerce website. This hugo site is to replace or supplement an existing webstore, which is my employer.
Most themes I’ve explored and many of the examples for how to manage content with hugo centers around having markdown files somewhere in a subdirectory of /content
which are rendered using partials. This part is not mysterious to me and is well documented.
The existing e-commerce website uses a database, probably sql, which I have exported as a CSV and converte to JSON for convenience. I have seen and followed the examples in data templates and was quite impressed actually. I was able to generate a list of ll the products and get images to load from their links on the existing site.
That was the extent of my progress. I was considering how to manually rework the categories, which have no straightforward way to work with hugo in their existing format (and I must really praise the multilevel menu feature of the crab theme which I discovered just yesterday!); but I’ve come up against a more vexxing issue, the one which brought me here, which I will state now:
We have over 5000 products listed on our ecommerce website. Is there a way to avoid having to have a markdown file for each and every product? All of the data for every product is in /data/data.json
and it seems utterly redundant to have to have it as separate files in separate directories depending on the category, and seeing as how some categories are subcategories and the same product would need to appear in each, it just doesn’t make sense to use that sort of blog-type format.
What I really want (need) is for the product to have it’s own page with its own url which is, for example:
myecommercesite.com/partnumber
with partnumber
being our internal part numbering scheme, and when substituiting the real part number it should show the product listing for that specific product.
I have looked very carefully and I can’t say that I have seen a way to have a link to a page without an accompanying markdown file / directory. Perhaps I’ve overlooked something. Surely there must be a way to do this! If there isn’t, there should be, and I will request this feature via the issues section of github.
additional context-
Hugo Static Site Generator v0.74.3/extended linux/amd64 BuildDate: unknown
I’m running this on arch linux.
A snippet of data.json - this is the database format used by networkolutions, the hosting / ecommerce provider for the existing site.
{
"ProductID": 107054,
"Name": "Copper Washer 11mm X 5.5mm",
"ShortDescription": "",
"LongDescription": "<span style=\"font-size: large;\">Copper Washer <br />11mm OD<br />5.5mm ID<br />1.3mm Thick<br /></span>",
"PartNumber": "9Z16XX",
"QuantityInStock": 18554,
"UnlimitedStock": "False",
"ReorderLevel": "",
"LicenseOption": "False",
"DownloadLimit": 0,
"Instructions": "",
"LicenseKeys": "",
"StoreCost": 0,
"CustomerPrice": 0.05,
"MSRP": 0,
"HandlingCost": 0,
"MinimumOrderQuantity": 1,
"MaximumOrderQuantity": 0,
"WeightMajor": 0,
"WeightMinor": 0.03,
"Length": 0,
"Width": 0,
"Height": 0,
"ManufacturerPartNumber": "",
"ManufacturerName": "",
"Categories": "Deals;Electromechanical ~ Hardware",
"Warehouse": "",
"ShippingMessage": "",
"CategorySpecial": "False",
"HomepageSpecial": "False",
"ShippingOption": "S",
"TaxFree": "False",
"ProductType": "S",
"RelatedProducts": "",
"PageLayout": "",
"ProductUrl": "http://WWW.MYECOMMERCESITE.COM/9Z16XX.aspx",
"ImageAltText": "",
"ImageCaptionText": "",
"ThumbnailPath": "http://www.myecommercesite.com/images/products/thumb/9z16XX.png",
"MediumImagePath": "http://www.myecommercesite.com/images/products/display/9z16XX.png",
"LargeImagePath": "http://www.myecommercesite.com/images/products/detail/9z16XX.png",
"MetaTitle": "Copper Washer 11mm X 5.5mm",
"MetaDescription": "",
"MetaKeywords": "",
"SortOrder": 0,
"Enable": "True",
"Purchasable": "True",
"PriceMessage": "",
"InStockMessage": "",
"OutOfStockMessage": "",
"Variations": "",
"Attributes": "",
"Delete": "False"
},
As you can see, there’s actually html in the long description. Sometimes there’s a table with data or specifications.
To reiterate one last time, I want to give each product a separate page, and a unique URL., but without the path existing on the fileystem- using only a database as I have described.