Skip to content

Commit

Permalink
Cleans up lint errors for the sitemapBaseFileName config.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Standel committed May 25, 2021
1 parent 5073f0d commit b13f7d8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Above is the minimal configuration to split a large sitemap. When the number of
| siteUrl | Base url of your website | string |
| changefreq (optional) | Change frequency. Default `daily` | string |
| priority (optional) | Priority. Default `0.7` | number |
| sitemapBaseFileName (optional) | The name of the generated sitemap file before the file extension. Default `"sitemap"` | string |
| sitemapBaseFileName (optional) | The name of the generated sitemap file before the file extension. Default `"sitemap"` | string |
| alternateRefs (optional) | Denote multi-language support by unique URL. Default `[]` | AlternateRef[] |
| sitemapSize(optional) | Split large sitemap into multiple files by specifying sitemap size. Default `5000` | number |
| generateRobotsTxt (optional) | Generate a `robots.txt` file and list the generated sitemaps. Default `false` | boolean |
Expand Down
6 changes: 5 additions & 1 deletion packages/next-sitemap/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ import { exportRobotsTxt } from './robots-txt'

// Split sitemap into multiple files
const chunks = toChunks(urlSet, config.sitemapSize!)
const sitemapChunks = resolveSitemapChunks(runtimePaths.SITEMAP_FILE, chunks, config)
const sitemapChunks = resolveSitemapChunks(
runtimePaths.SITEMAP_FILE,
chunks,
config
)

// All sitemaps array to keep track of generated sitemap files.
// Later to be added on robots.txt
Expand Down
2 changes: 1 addition & 1 deletion packages/next-sitemap/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const defaultConfig: Partial<IConfig> = {
sourceDir: '.next',
outDir: 'public',
priority: 0.7,
sitemapBaseFileName: "sitemap",
sitemapBaseFileName: 'sitemap',
changefreq: 'daily',
sitemapSize: 5000,
autoLastmod: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-sitemap/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface IConfig {
siteUrl: string
changefreq: string
priority: any
sitemapBaseFileName?: string;
sitemapBaseFileName?: string
sourceDir?: string
outDir?: string
sitemapSize?: number
Expand Down
4 changes: 3 additions & 1 deletion packages/next-sitemap/src/path/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export const resolveSitemapChunks = (
): ISitemapChunk[] => {
const folder = path.dirname(baseSitemapPath)
return chunks.map((chunk, index) => {
const filename = `${config.sitemapBaseFileName}${index > 0 ? `-${index}` : ''}.xml`
const filename = `${config.sitemapBaseFileName}${
index > 0 ? `-${index}` : ''
}.xml`

return {
path: `${folder}/${filename}`,
Expand Down

0 comments on commit b13f7d8

Please sign in to comment.