Dynamic URL for sitemap in robots.ts
Unanswered
New Zealand posted this in #help-forum
New ZealandOP
I have a simple robots.ts file to generate robots.txt. Since my app is used as a multitenancy app deployed to several different URLs I need the host and domain part of the sitemap URL to be dynamic. I figured I could achieve this by using an environment variable that is inserted at deploy time (not available at build time) since it's supposed to be generated. But when I do this it seems that the variable isn't picked up at runtime and is undefined.
If this isn't achievable, what can be another way of finding the current domain and host during runtime?
Using app router in Next 13.4.7
If this isn't achievable, what can be another way of finding the current domain and host during runtime?
Using app router in Next 13.4.7
1 Reply
try updating to the latest version