So, I’m essentially using Hugo as a JSON API for my content.
Hugo creates a folder (with an index.json) for each page that I create in my /content folder. However, I’ve noticed it won’t create any additional folders for any additional aliases that I define within the front matter.
How would I essentially go about doing this, so Hugo will generate those additional folders, since that’s really the only solution that would work in my case?
I expected that when generating the files, it would create new JSON files for the alias slugs defined within the font-matter of content located within content/practices. However, it only creates files associated with the slug of the post.
My understanding is that it will generate separate html files for those alias slugs, however it does not seem to be doing the same for Json generated content.
I’m not 100% sure if this is relevant, but this is what I have defined in my config.toml for custom data types:
The alias system in Hugo was not created for your use case; it is based on the web pattern of loading a web page with a redirect timer. That pattern isn’t great for handling redirects in an API.
Obviously when you look at how Netlify redirects work, you might be able to get creative, but if you are doing redirects, that means you are feeding a web server a list of URLs mapped to other URLs. What I mean is: how would you do this without Hugo? Work back from there.
At least this is how I think it works. I don’t know that much JSON stuff, so maybe I’m off on how redirecting API endpoints is…