Add robots.txt and sitemap with correct public routes.
Serve only indexable pages to crawlers and copy the SEO files into the Vite/Docker build output. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,6 +18,8 @@ FROM docker.arvancloud.ir/nginxinc/nginx-unprivileged:1.28-alpine AS runtime
|
||||
|
||||
COPY --chown=nginx:nginx nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build --chown=nginx:nginx /app/dist /usr/share/nginx/html
|
||||
COPY --from=build --chown=nginx:nginx /app/robots.txt /usr/share/nginx/html/robots.txt
|
||||
COPY --from=build --chown=nginx:nginx /app/sitemap.xml /usr/share/nginx/html/sitemap.xml
|
||||
|
||||
USER nginx
|
||||
|
||||
|
||||
8
robots.txt
Normal file
8
robots.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
Disallow: /profile
|
||||
Disallow: /login
|
||||
Disallow: /advanced-verification
|
||||
Disallow: /noactive-payment
|
||||
|
||||
Sitemap: https://persain-game.com/sitemap.xml
|
||||
27
sitemap.xml
Normal file
27
sitemap.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://persain-game.com/</loc>
|
||||
<lastmod>2026-11-02</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://persain-game.com/tutorial</loc>
|
||||
<lastmod>2026-11-02</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://persain-game.com/rule</loc>
|
||||
<lastmod>2026-11-02</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.6</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://persain-game.com/about</loc>
|
||||
<lastmod>2026-11-02</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.6</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
@@ -1,7 +1,20 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { copyFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
function copySeoFiles() {
|
||||
return {
|
||||
name: "copy-seo-files",
|
||||
closeBundle() {
|
||||
const root = resolve(__dirname);
|
||||
const outDir = resolve(root, "dist");
|
||||
copyFileSync(resolve(root, "robots.txt"), resolve(outDir, "robots.txt"));
|
||||
copyFileSync(resolve(root, "sitemap.xml"), resolve(outDir, "sitemap.xml"));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
plugins: [react(), copySeoFiles()],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user