Create multiple HTMLs for the same markdown files (docuapi)

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.

Any ideas?

Not sure why you need two different HTML files. Sounds like you could trigger the banner display by detecting region with JS.

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 }}

The CMP I am using is Open Source version of Klaro (GitHub - kiprotect/klaro: Klaro! A privacy and security tool for your website.) and that version doesn’t have a good API to turn it on or off.

Moreover, the other problem is, it requires me to include the scripts in a specific manner (GitHub - kiprotect/klaro: Klaro! A privacy and security tool for your website.) which Klaro itself changes as per user’s choice.

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.

Thanks for the ideas!