I am using Docuapi for our developer documentation.
The docuapi theme combines all markdown files into one and generates a single HTML file.
I am using a Consent Management system to display a cookie consent banner.
The site is deployed using Cloudfront CDN.
I want to display this banner only for the requests coming from a certain region.
Is it possible to generate two different html files out of hugo for the same markdown files, with the same URL structure, and load them depending on which region the request is coming from?
I can setup my CDN to access different files based on the request.
While @jmooring is right, as I assume the consent banner would need JS enabled to work, so you might as well add a ?consentRegion=true to the URLs or something.
That said, what you can do is to run Hugo multiple times with different baseURL, e.g.:
hugo -b https://example.com
HUGO_PARAMS_SHOWCONSENT=true hugo -b https://example.com/consentregion
Then you can do this in a template:
{{ if site.Params.showConsent }}
// show consent
{{ end }}
I have been trying to write JS code to affect this functionality as per the region, but haven’t gotten very far.
Hence I wanted to check if there is a way to create another HTML output and write logic at my CDN to load them as per the region the request is coming from.