[feat] add sitemap for better SEO

This commit is contained in:
Alvalen 2023-09-06 16:46:06 +07:00
parent 5a87f0c3e9
commit 7286380302
5 changed files with 68 additions and 1 deletions

11
app/sitemap.js Normal file
View 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;