Dynamic robots.txt file, and add sitemap.xml.

This commit is contained in:
wearrrrr 2024-04-04 09:24:01 -05:00
parent 74cd71e255
commit da9413930e
4 changed files with 49 additions and 0 deletions

View file

@ -145,6 +145,13 @@ app.use("/", express.static("dist/client/"));
app.get("/favicon.ico", (req, res) => {
res.sendFile(path.join(process.cwd(), "dist/client/favicon.svg"));
});
app.get("/robots.txt", (req, res) => {
if (req.headers.host && whiteListedDomains.includes(req.headers.host)) {
res.sendFile(path.join(process.cwd(), "dist/client/robots-allow.txt"));
} else {
res.sendFile(path.join(process.cwd(), "dist/client/robots-deny.txt"));
}
})
app.get("/search", async (req, res) => {
try {
const { query } = req.query;

2
public/robots-deny.txt Normal file
View file

@ -0,0 +1,2 @@
User-agent: *
Disallow: *

40
public/sitemap.xml Normal file
View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://aluu.xyz/en/</loc>
<lastmod>2024-04-03T02:13:11+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://aluu.xyz/en/games/</loc>
<lastmod>2024-04-03T02:13:11+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://aluu.xyz/en/settings/</loc>
<lastmod>2024-04-03T02:13:11+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://aluu.xyz/jp/</loc>
<lastmod>2024-04-03T02:13:11+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://aluu.xyz/jp/games/</loc>
<lastmod>2024-04-03T02:13:11+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://aluu.xyz/jp/settings/</loc>
<lastmod>2024-04-03T02:13:11+00:00</lastmod>
<priority>0.80</priority>
</url>
</urlset>