Dynamic robots.txt file, and add sitemap.xml.
This commit is contained in:
parent
74cd71e255
commit
da9413930e
4 changed files with 49 additions and 0 deletions
7
index.js
7
index.js
|
|
@ -145,6 +145,13 @@ app.use("/", express.static("dist/client/"));
|
||||||
app.get("/favicon.ico", (req, res) => {
|
app.get("/favicon.ico", (req, res) => {
|
||||||
res.sendFile(path.join(process.cwd(), "dist/client/favicon.svg"));
|
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) => {
|
app.get("/search", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { query } = req.query;
|
const { query } = req.query;
|
||||||
|
|
|
||||||
2
public/robots-deny.txt
Normal file
2
public/robots-deny.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
User-agent: *
|
||||||
|
Disallow: *
|
||||||
40
public/sitemap.xml
Normal file
40
public/sitemap.xml
Normal 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>
|
||||||
Loading…
Add table
Reference in a new issue