Skip to content

Commit

Permalink
Merge branch 'master' into omit-not-found-default-locale
Browse files Browse the repository at this point in the history
  • Loading branch information
sreetamdas committed Aug 29, 2022
2 parents fa37fb9 + a8ccb37 commit 1441124
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 211 deletions.
32 changes: 8 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ yarn add next-sitemap
```js
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
siteUrl: process.env.SITE_URL || 'https://example.com',
generateRobotsTxt: true, // (optional)
// ...other options
}

export default config
```

### Building sitemaps
Expand Down Expand Up @@ -82,13 +80,11 @@ Define the `sitemapSize` property in `next-sitemap.config.js` to split large sit

```js
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
siteUrl: 'https://example.com',
generateRobotsTxt: true,
sitemapSize: 7000,
}

export default config
```

Above is the minimal configuration to split a large sitemap. When the number of URLs in a sitemap is more than 7000, `next-sitemap` will create sitemap (e.g. sitemap-0.xml, sitemap-1.xml) and index (e.g. sitemap.xml) files.
Expand Down Expand Up @@ -124,7 +120,7 @@ Returning `null` value from the transformation function will result in the exclu

```jsx
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
transform: async (config, path) => {
// custom function to ignore the path
if (customIgnoreFunction(path)) {
Expand All @@ -151,8 +147,6 @@ const config = {
}
},
}

export default config
```
## Additional paths function
Expand All @@ -163,7 +157,7 @@ If your function returns a path that already exists, then it will simply be upda
```js
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
additionalPaths: async (config) => {
const result = []

Expand Down Expand Up @@ -196,8 +190,6 @@ const config = {
return result
},
}

export default config
```
## Full configuration example
Expand All @@ -207,7 +199,7 @@ Here's an example `next-sitemap.config.js` configuration with all options
```js
/** @type {import('next-sitemap').IConfig} */

const config = {
module.exports = {
siteUrl: 'https://example.com',
changefreq: 'daily',
priority: 0.7,
Expand Down Expand Up @@ -259,8 +251,6 @@ const config = {
],
},
}

export default config
```
Above configuration will generate sitemaps based on your project and a `robots.txt` like this.
Expand Down Expand Up @@ -329,8 +319,7 @@ List the dynamic sitemap page in `robotsTxtOptions.additionalSitemaps` and exclu
// next-sitemap.config.js
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
siteUrl: 'https://example.com',
generateRobotsTxt: true,
exclude: ['/server-sitemap-index.xml'], // <= exclude here
Expand Down Expand Up @@ -388,8 +377,7 @@ List the dynamic sitemap page in `robotsTxtOptions.additionalSitemaps` and exclu
// next-sitemap.config.js
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
siteUrl: 'https://example.com',
generateRobotsTxt: true,
exclude: ['/server-sitemap.xml'], // <= exclude here
Expand All @@ -399,8 +387,6 @@ const config = {
],
},
}
export default config
```

In this way, `next-sitemap` will manage the sitemaps for all your static pages and your dynamic sitemap will be listed on robots.txt.
Expand All @@ -411,11 +397,9 @@ Add the following line of code in your `next-sitemap.config.js` for nice typescr

```js
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
// YOUR CONFIG
}
export default config
```

![TS_JSDOC](./assets/ts-jsdoc.png)
Expand Down
4 changes: 2 additions & 2 deletions examples/amp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
4 changes: 2 additions & 2 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
4 changes: 2 additions & 2 deletions examples/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
4 changes: 2 additions & 2 deletions examples/custom-config-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
4 changes: 2 additions & 2 deletions examples/custom-overrides/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
4 changes: 2 additions & 2 deletions examples/custom-robots-txt-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
4 changes: 2 additions & 2 deletions examples/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
4 changes: 2 additions & 2 deletions examples/no-index-sitemaps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"dependencies": {
"@types/react-dom": "^18.0.6",
"next": "^12.2.3",
"next": "^12.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.16",
"@types/react": "^18.0.17",
"next-sitemap": "*"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
},
"devDependencies": {
"@corex/workspace": "^4.0.29",
"turbo": "^1.4.0"
"turbo": "^1.4.3"
}
}

0 comments on commit 1441124

Please sign in to comment.