Skip to content

Commit 260a797

Browse files
committed
Add sitemap
1 parent cbe4001 commit 260a797

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

next-sitemap.config.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/** @type {import('next-sitemap').IConfig} */
2+
module.exports = {
3+
siteUrl: "https://my-lib-pro.netlify.app",
4+
generateRobotsTxt: true,
5+
exclude: ["/", "/code-items*", "/login", "/registration"],
6+
robotsTxtOptions: {
7+
policies: [
8+
{
9+
userAgent: "*",
10+
allow: "/about",
11+
disallow: ["/", "/code-items*", "/login", "/registration"],
12+
},
13+
],
14+
},
15+
16+
transform: async (config, path) => {
17+
const defaultEntry = {
18+
loc: path,
19+
changefreq: "monthly",
20+
priority: 0.5,
21+
lastmod: new Date().toISOString(),
22+
};
23+
24+
if (path === "/about") {
25+
return {
26+
...defaultEntry,
27+
changefreq: "monthly",
28+
priority: 0.9,
29+
};
30+
}
31+
32+
return defaultEntry;
33+
},
34+
};

package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"dev": "next dev",
77
"build": "next build",
8+
"postbuild": "next-sitemap",
89
"start": "next start",
910
"lint": "next lint",
1011
"test": "jest",
@@ -58,6 +59,7 @@
5859
"mui-tiptap": "^1.17.1",
5960
"next": "15.1.7",
6061
"next-auth": "^4.24.11",
62+
"next-sitemap": "^4.2.3",
6163
"notistack": "^3.0.2",
6264
"react": "^19.0.0",
6365
"react-dom": "^19.0.0",

0 commit comments

Comments
 (0)