From 29d66a1621fe6ae6402756136f01e03d40508559 Mon Sep 17 00:00:00 2001 From: soheil khaledabadi Date: Mon, 2 Nov 2026 01:08:42 +0330 Subject: [PATCH] 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 --- Dockerfile | 2 ++ robots.txt | 8 ++++++++ sitemap.xml | 27 +++++++++++++++++++++++++++ vite.config.ts | 21 +++++++++++++++++---- 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 robots.txt create mode 100644 sitemap.xml diff --git a/Dockerfile b/Dockerfile index 04a87d3..490e9db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..1231518 --- /dev/null +++ b/robots.txt @@ -0,0 +1,8 @@ +User-agent: * +Allow: / +Disallow: /profile +Disallow: /login +Disallow: /advanced-verification +Disallow: /noactive-payment + +Sitemap: https://persain-game.com/sitemap.xml diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..a7e36eb --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,27 @@ + + + + https://persain-game.com/ + 2026-11-02 + daily + 1.0 + + + https://persain-game.com/tutorial + 2026-11-02 + weekly + 0.8 + + + https://persain-game.com/rule + 2026-11-02 + monthly + 0.6 + + + https://persain-game.com/about + 2026-11-02 + monthly + 0.6 + + diff --git a/vite.config.ts b/vite.config.ts index 7ea1e81..a91ee39 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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()], });