diff --git a/package.json b/package.json index 3c681531..ced90d44 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "tailwindcss": "^3.4.17", "typescript": "^5.7.2", "typescript-eslint": "^8.18.2", - "vite": "^5.4.11" + "vite": "^5.4.11", + "vite-plugin-sitemap": "^0.7.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a9ea4192..88572c3d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,6 +84,9 @@ importers: vite: specifier: ^5.4.11 version: 5.4.11(@types/node@22.10.2) + vite-plugin-sitemap: + specifier: ^0.7.1 + version: 0.7.1 packages: @@ -1478,6 +1481,9 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + vite-plugin-sitemap@0.7.1: + resolution: {integrity: sha512-4NRTkiWytLuAmcikckrLcLl9iYA20+5v6l8XshcOrzxH1WR8H0O3S6sTQYfjMrE8su/LG6Y0cTodvOdcOIxaLw==} + vite@5.4.11: resolution: {integrity: sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==} engines: {node: ^18.0.0 || >=20.0.0} @@ -2881,6 +2887,8 @@ snapshots: util-deprecate@1.0.2: {} + vite-plugin-sitemap@0.7.1: {} + vite@5.4.11(@types/node@22.10.2): dependencies: esbuild: 0.21.5 diff --git a/vite.config.ts b/vite.config.ts index d702e76a..378e6b99 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,9 +1,19 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { resolve } from 'path'; +import ViteSitemap from 'vite-plugin-sitemap'; export default defineConfig({ - plugins: [react()], + plugins: [ + react(), + ViteSitemap({ + hostname: 'https://www.snigdhaos.org', + outDir: './dist', + changefreq: 'daily', + priority: 0.7, + // lastmod: true, + }), + ], resolve: { alias: { '@': resolve(__dirname, './src'), @@ -12,14 +22,12 @@ export default defineConfig({ build: { rollupOptions: { output: { - // Make sure main.js is generated as part of the build entryFileNames: 'main.js', - // Output CSS as a separate file (style.css) assetFileNames: ({ name }) => { if (name && name.endsWith('.css')) { - return 'style.css'; // Ensure style.css is generated + return 'style.css'; } - return 'assets/[name]-[hash][extname]'; // Other assets (images, etc.) + return 'assets/[name]-[hash][extname]'; }, }, },