[feat] add sitemap for better SEO
This commit is contained in:
parent
5a87f0c3e9
commit
7286380302
5 changed files with 68 additions and 1 deletions
11
app/sitemap.js
Normal file
11
app/sitemap.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { createReadStream } from 'fs';
|
||||
import { ServerResponse } from 'http';
|
||||
|
||||
const sitemapHandler = async (_, res = ServerResponse) => {
|
||||
const sitemap = createReadStream('./public/sitemap.xml.gz');
|
||||
res.setHeader('content-type', 'application/xml');
|
||||
res.setHeader('content-encoding', 'gzip');
|
||||
sitemap.pipe(res);
|
||||
};
|
||||
|
||||
export default sitemapHandler;
|
||||
Loading…
Add table
Add a link
Reference in a new issue