diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e15c008 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +URL="base url. example: 'https://example.com' " \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6d4c0aa..cd4c6ec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ dist/ # generated types .astro/ +.vercel/ # dependencies node_modules/ diff --git a/astro.config.mjs b/astro.config.mjs index 02ee958..b2dcbd6 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,6 +1,7 @@ import { defineConfig } from 'astro/config'; import react from '@astrojs/react'; import tailwindcss from '@astrojs/tailwind'; +import sitemap from '@astrojs/sitemap'; import vercel from "@astrojs/vercel/static" // https://astro.build/config @@ -8,6 +9,7 @@ export default defineConfig({ server: { port: 8081 }, + site: process.env.URL, adapter: vercel({ webAnalytics: { enabled: true, @@ -21,5 +23,5 @@ export default defineConfig({ } } }, - integrations: [react(), tailwindcss()] + integrations: [sitemap(), react(), tailwindcss()] }); diff --git a/bun.lockb b/bun.lockb index 529449a..049cdf9 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 0f9eeab..7580389 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "tic-tac-toe-world", - "version": "1.2.6", + "version": "1.2.7", "scripts": { "dev": "astro dev --host", "start:build": "astro check && astro build && astro preview --host", @@ -22,8 +22,9 @@ "tailwindcss": "^3.4.1" }, "devDependencies": { - "@types/react": "^18.2.48", "@astrojs/check": "^0.4.1", + "@astrojs/sitemap": "^3.0.5", + "@types/react": "^18.2.48", "@types/react-dom": "^18.2.18", "autoprefixer": "^10.4.17", "cssnano": "^6.0.3", diff --git a/src/layouts/LayoutHTML.astro b/src/layouts/LayoutHTML.astro index 44c4f65..d36fb3a 100644 --- a/src/layouts/LayoutHTML.astro +++ b/src/layouts/LayoutHTML.astro @@ -16,6 +16,7 @@ const { title, description = "" }: Props = Astro.props; {title} + diff --git a/src/pages/robot.txt.ts b/src/pages/robot.txt.ts new file mode 100644 index 0000000..2da57c0 --- /dev/null +++ b/src/pages/robot.txt.ts @@ -0,0 +1,16 @@ +import type { APIRoute } from 'astro'; + +const robotsTxt = ` +User-agent: * +Allow: / + +Sitemap: ${new URL('sitemap-index.xml', process.env.URL).href} +`.trim(); + +export const GET: APIRoute = () => { + return new Response(robotsTxt, { + headers: { + 'Content-Type': 'text/plain; charset=utf-8', + }, + }); +}; \ No newline at end of file