Skip to content

Commit ba2abfc

Browse files
committed
Add sitemap
1 parent cbe4001 commit ba2abfc

File tree

4 files changed

+77
-1
lines changed

4 files changed

+77
-1
lines changed

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
package = "@netlify/plugin-nextjs"
33

44
[build]
5-
command = "next build"
5+
command = "next build && next-sitemap"
66
publish = ".next"
77

next-sitemap.config.js

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

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"mui-tiptap": "^1.17.1",
5959
"next": "15.1.7",
6060
"next-auth": "^4.24.11",
61+
"next-sitemap": "^4.2.3",
6162
"notistack": "^3.0.2",
6263
"react": "^19.0.0",
6364
"react-dom": "^19.0.0",

0 commit comments

Comments
 (0)