how to dynamic set sitemap in robots.txt
See original GitHub issuein front-end, I can get window.location.origin like this screenshot
but i want set dynamic sitemap in nuxt.config.js in robots.txt
ex: robots: { UserAgent: '*', Sitemap: ${window.location.origin}/sitemap.xml }
,
here window object is not exist , Is there any good way to resolve it ? Thanks !
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Create dynamic sitemap, humans.txt and robots.txt files
Create dynamic sitemap, humans.txt and robots.txt files ... To help search engines like Bing and Google index your website you can use sitemaps...
Read more >Dynamic Sitemap URL in robots.txt file - Stack Overflow
In any case, make sure to send the correct Content-Type for this file. Some servers automatically select a content type based on the...
Read more >Can the files robots.txt and sitemap.xml be dynamic through ...
Sitemap.xml files are static and only updates make them dynamic - they do not updating in real time. It's possible of cause to...
Read more >How to add SITEMAP and robots.txt to Next.js application (fast ...
Sitemap.xml and robots. txt are important for SEO. We will use Next.js API Routes for generating sitemap dynamically every time user (or ...
Read more >Add Your Sitemap To Your Robots.txt File - WooRank
The Robots.txt file is a simple text file that is placed on your site's root directory. This file uses a set of instructions...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not sure about the hook but robots.txt serves for more purposes than adding the sitemap URL (which will likely be generated by your own app or a third party module). The point here is that if you pretend to have a dynamic sitemap URL (or any other property in your robots file), it has to run on SSR as that function needs to be executed, otherwise you can make it static with an ENV var.