Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 0d3d5e1

Browse files
updated site-mapping
1 parent d656536 commit 0d3d5e1

File tree

6 files changed

+83
-10
lines changed

6 files changed

+83
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Here are some of the core dependencies and features:
2424
- [Remark](https://www.npmjs.com/package/remark-package-dependencies) - Inject to markdown the list of dependencies of your package
2525
- [Remark MDX](https://www.npmjs.com/package/remark-mdx) - Remark plugin to support the MDX syntax
2626
- [date-fns](https://date-fns.org/v2.16.1/docs/format) - Return the formatted date string in the given format
27+
- [site-map](https://github.com/iamvishnusankar/next-sitemap) - Sitemap generator for next.js. Generate sitemap(s) and robots.txt for all static/pre-rendered/dynamic/server-side pages.
2728
- [robots.txt](https://developers.google.com/search/docs/advanced/robots/intro) - Tells search engine crawlers which URLs the crawler can access on your site.
2829

2930
### To Use

package-lock.json

Lines changed: 49 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
@@ -6,6 +6,7 @@
66
"scripts": {
77
"dev": "next dev",
88
"build": "next build",
9+
"postbuild": "next-sitemap",
910
"format": "prettier --ignore-path .gitignore --write .",
1011
"start": "next start",
1112
"export": "next build && next export",
@@ -60,6 +61,7 @@
6061
"eslint-plugin-react-hooks": "^4.3.0",
6162
"jest": "^28.1.3",
6263
"jest-environment-jsdom": "^28.1.3",
64+
"next-sitemap": "^3.1.17",
6365
"postcss": "^8.4.16",
6466
"postcss-preset-env": "^7.7.2",
6567
"prettier": "^2.7.1",

public/next-sitemap.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('next-sitemap').IConfig} */
2+
const config = {
3+
siteUrl: process.env.SITE_URL || 'https://example.com',
4+
generateRobotsTxt: true, // (optional)
5+
// ...other options
6+
}
7+
8+
export default config

public/robots.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
# Block all crawlers for /accounts
2+
User-agent: *
3+
Disallow: /accounts
4+
5+
# Googlebot is not allowed to crawl any URL that starts with http://example.com/nogooglebot/
16
User-agent: Googlebot
27
Disallow: /nogooglebot/
38

9+
# Allow all crawlers - All other user agents are allowed to crawl the entire site.
410
User-agent: *
511
Allow: /
612

7-
Sitemap: http://www.example.com/sitemap.xml
8-
9-
10-
/*
11-
1. The user agent named Googlebot is not allowed to crawl any URL that starts with http://example.com/nogooglebot/.
12-
2. All other user agents are allowed to crawl the entire site. This could have been omitted and the result would be the same; the default behavior is that user agents are allowed to crawl the entire site.
13-
3. The site's sitemap file is located at http://www.example.com/sitemap.xml.
14-
*/
13+
# The site's sitemap file is located at:
14+
Sitemap: http://www.SITE.com/sitemap.xml

yarn.lock

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@
322322
"resolved" "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz"
323323
"version" "1.5.0"
324324

325+
"@corex/deepmerge@^4.0.29":
326+
"integrity" "sha512-q/yVUnqckA8Do+EvAfpy7RLdumnBy9ZsducMUtZTvpdbJC7azEf1hGtnYYxm0QfphYxjwggv6XtH64prvS1W+A=="
327+
"resolved" "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.29.tgz"
328+
"version" "4.0.29"
329+
325330
"@cspotcode/source-map-support@^0.8.0":
326331
"integrity" "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="
327332
"resolved" "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz"
@@ -834,7 +839,7 @@
834839
"@types/mdx" "^2.0.0"
835840
"@types/react" ">=16"
836841

837-
"@next/env@12.2.4":
842+
"@next/env@*", "@next/env@12.2.4":
838843
"integrity" "sha512-/gApFXWk5CCLFQJL5IYJXxPQuG5tz5nPX4l27A9Zm/+wJxiwFrRSP54AopDxIv4JRp/rGwcgk/lZS/0Clw8jYA=="
839844
"resolved" "https://registry.npmjs.org/@next/env/-/env-12.2.4.tgz"
840845
"version" "12.2.4"
@@ -5300,7 +5305,15 @@
53005305
"resolved" "https://registry.npmjs.org/next-seo/-/next-seo-5.5.0.tgz"
53015306
"version" "5.5.0"
53025307

5303-
"next@^8.1.1-canary.54 || >=9.0.0", "next@latest":
5308+
"next-sitemap@^3.1.17":
5309+
"integrity" "sha512-xop7KgEbWsqOe4Fr50g9RQ1UGb1bAEJoKYVVynbUqietpSltAnCIzvq/StL2gZcNyFW9K+9tZV7EpcD+72gRrA=="
5310+
"resolved" "https://registry.npmjs.org/next-sitemap/-/next-sitemap-3.1.17.tgz"
5311+
"version" "3.1.17"
5312+
dependencies:
5313+
"@corex/deepmerge" "^4.0.29"
5314+
"minimist" "^1.2.6"
5315+
5316+
"next@*", "next@^8.1.1-canary.54 || >=9.0.0", "next@latest":
53045317
"integrity" "sha512-b1xlxEozmAWokAXzXsi5vlmU/IfJcFNIJA8dpU5UdkFbyDPio8wwb8mAQ/Y7rGtfTgG/t/u49BiyEA+xAgFvow=="
53055318
"resolved" "https://registry.npmjs.org/next/-/next-12.2.4.tgz"
53065319
"version" "12.2.4"

0 commit comments

Comments
 (0)