Skip to content

Commit

Permalink
Rename all exports.default to module.exports
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvishnusankar committed Aug 21, 2022
1 parent 1245d2b commit 02ac765
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions README.md
Expand Up @@ -41,13 +41,12 @@ 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 +81,12 @@ 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 +122,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 Down Expand Up @@ -152,7 +150,6 @@ const config = {
},
}

export default config
```
## Additional paths function
Expand All @@ -163,7 +160,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 @@ -197,7 +194,6 @@ const config = {
},
}

export default config
```
## Full configuration example
Expand All @@ -207,7 +203,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 @@ -260,7 +256,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 @@ -330,7 +325,7 @@ List the dynamic sitemap page in `robotsTxtOptions.additionalSitemaps` and exclu
/** @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 @@ -389,7 +384,7 @@ List the dynamic sitemap page in `robotsTxtOptions.additionalSitemaps` and exclu
/** @type {import('next-sitemap').IConfig} */
const config = {
module.exports = {
siteUrl: 'https://example.com',
generateRobotsTxt: true,
exclude: ['/server-sitemap.xml'], // <= exclude here
Expand All @@ -400,7 +395,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,15 +405,14 @@ 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)

## Contribution

All PRs are welcome :)
All PRs are welcome :)

0 comments on commit 02ac765

Please sign in to comment.