Created
September 6, 2020 18:55
-
-
Save paulphys/9d1f66a4b854ccafccc1eba4c4b5740b to your computer and use it in GitHub Desktop.
robots.txt for typescript react
This file contains 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
// directory: pages/robots.txt.tsx | |
import React from 'react'; | |
const getRobots = () => `User-agent: * | |
Disallow: / | |
`; | |
class Sitemap extends React.Component { | |
public static async getInitialProps({res}:{ res:any }) { | |
res.setHeader('Content-Type', 'text/plain'); | |
res.write(getRobots()); | |
res.end(); | |
} | |
} | |
export default Sitemap; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment