diff --git a/pages/robots.txt.tsx b/pages/robots.txt.tsx new file mode 100644 index 0000000..cf85d6a --- /dev/null +++ b/pages/robots.txt.tsx @@ -0,0 +1,14 @@ +import React from 'react' + +import { host } from 'lib/config' + +export default class Robots extends React.Component { + static async getInitialProps({ res }) { + res.setHeader('Content-Type', 'text/plain') + res.write(`User-agent: * +Allow: / +Sitemap: ${host}/sitemap.xml +`) + res.end() + } +} diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index 14267e9..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Allow: / \ No newline at end of file