diff --git a/README.md b/README.md index 37ef8b9..fdb5281 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,10 @@ - 🐢 Husky & Lint Staged - Run scripts on your staged files before they are committed - πŸ”Ή Icons - From Lucide - πŸŒ‘ Dark mode - With next-themes -- πŸ—ΊοΈ Sitemap & robots.txt - With next-sitemap - πŸ“ Commitlint - Lint your git commits - πŸ€– Github actions - Lint your code on PR - βš™οΈ T3-env - Manage your environment variables +- πŸ—ΊοΈ Sitemap & robots.txt - πŸ’― Perfect Lighthouse score - 🌐 I18n with Paraglide diff --git a/next-sitemap.config.js b/next-sitemap.config.js deleted file mode 100644 index e37205b..0000000 --- a/next-sitemap.config.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - siteUrl: process.env.APP_URL, - generateRobotsTxt: true, - robotsTxtOptions: { - policies: [{ userAgent: '*', allow: '/' }], - }, -}; diff --git a/package-lock.json b/package-lock.json index 8bea68d..ad1625b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,8 +56,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "lint-staged": "^15.2.7", - "next-sitemap": "^4.2.3", - "postcss": "8.4.39", + "postcss": "^8", "prettier": "^3.3.2", "prisma": "^5.16.2", "tailwindcss": "^3.4.4", @@ -1183,12 +1182,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/@corex/deepmerge": { - "version": "4.0.43", - "resolved": "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.43.tgz", - "integrity": "sha512-N8uEMrMPL0cu/bdboEWpQYb/0i2K5Qn8eCsxzOmxSggJbbQte7ljMRoXm917AbntqTGOzdTu+vP3KOOzoC70HQ==", - "dev": true - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -9205,39 +9198,6 @@ } } }, - "node_modules/next-sitemap": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/next-sitemap/-/next-sitemap-4.2.3.tgz", - "integrity": "sha512-vjdCxeDuWDzldhCnyFCQipw5bfpl4HmZA7uoo3GAaYGjGgfL4Cxb1CiztPuWGmS+auYs7/8OekRS8C2cjdAsjQ==", - "dev": true, - "funding": [ - { - "url": "https://github.com/iamvishnusankar/next-sitemap.git" - } - ], - "dependencies": { - "@corex/deepmerge": "^4.0.43", - "@next/env": "^13.4.3", - "fast-glob": "^3.2.12", - "minimist": "^1.2.8" - }, - "bin": { - "next-sitemap": "bin/next-sitemap.mjs", - "next-sitemap-cjs": "bin/next-sitemap.cjs" - }, - "engines": { - "node": ">=14.18" - }, - "peerDependencies": { - "next": "*" - } - }, - "node_modules/next-sitemap/node_modules/@next/env": { - "version": "13.5.6", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.6.tgz", - "integrity": "sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==", - "dev": true - }, "node_modules/next-themes": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.3.0.tgz", @@ -9835,6 +9795,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ diff --git a/package.json b/package.json index ae862f2..abc148a 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "test:watch": "jest --watchAll", "e2e": "playwright test", "e2e:ui": "playwright test --ui", - "postbuild": "next-sitemap --config next-sitemap.config.js", "prepare": "husky", "postinstall": "paraglide-js compile --project ./project.inlang --outdir ./src/paraglide" }, @@ -79,7 +78,6 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "lint-staged": "^15.2.7", - "next-sitemap": "^4.2.3", "postcss": "^8", "prettier": "^3.3.2", "prisma": "^5.16.2", diff --git a/src/app/robots.ts b/src/app/robots.ts new file mode 100644 index 0000000..a5f4a27 --- /dev/null +++ b/src/app/robots.ts @@ -0,0 +1,13 @@ +import { MetadataRoute } from 'next'; + +import { env } from '@/env.mjs'; + +export default function robots(): MetadataRoute.Robots { + return { + rules: { + userAgent: '*', + allow: '/', + }, + sitemap: `${env.APP_URL}/sitemap.xml`, + }; +} diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts new file mode 100644 index 0000000..c0ca26a --- /dev/null +++ b/src/app/sitemap.ts @@ -0,0 +1,19 @@ +import { MetadataRoute } from 'next'; + +import { env } from '@/env.mjs'; + +export default function sitemap(): MetadataRoute.Sitemap { + return [ + { + url: env.APP_URL || '/', + lastModified: new Date(), + changeFrequency: 'yearly', + priority: 1, + alternates: { + languages: { + pl: `${env.APP_URL}/pl`, + }, + }, + }, + ]; +}