I have an API from which I’m trying to get data, but first, a request must be made that assigns a cookie to the client, which needs to be passed in subsequent requests, i.e.:
But only if the cookie from the first request is passed. Is this possible with Hugo?
–
Right now, instead of using an adapter that runs during the build and forms a map with data from the API, I use a custom Go file that runs (go run init.go) in CI before the direct call to hugo build and saves the necessary JSON files for the site. But I would prefer to do this directly using Hugo.
Basically, the solution boils down to a snippet like this, which solves my problem. I was using version 0.139 of Hugo, but I found the commit with the necessary functionality, which is available from version 0.143 onwards.