Created
October 22, 2018 09:26
-
-
Save antony/c66327ee9293f74abbeeb8d2e3b1f639 to your computer and use it in GitHub Desktop.
Simple robots.txt generation for Sapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
UserAgent: '*', | |
Disallow: '/' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lives in routes/robots.txt.js | |
const robots = process.env.robotsTxt | |
export function get (req, res) { | |
res.setHeader('Content-Type', 'text/plain') | |
const content = Object.keys(robots) | |
.reduce((acc, next) => { | |
return acc += `${next}: ${robots[next]}\n` | |
}, '') | |
res.end(content) | |
} |
if you don't have any dynamic content in it, yes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can we simply create file
/static/robots.txt
?