Skip to content

Commit

Permalink
feat(plugin-sitemap): rename excludeUrls to excludePaths (#45)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `excludeUrls` is renamed to `excludePaths`
  • Loading branch information
Mister-Hope authored Jan 31, 2024
1 parent 4268fdc commit 247c792
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/plugins/sitemap/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

- Example: `['/about.html', '/api/']`

## excludeUrls
## excludePaths

- Type: `string[]`

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/sitemap/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ By default, all site links except 404 page will be added to the Sitemap.

To add other pages to the Sitemap outside the VuePress project page, please turn them into an array and pass to the `extraUrls` plugin option.

If you don't want certain pages to appear in the sitemap, you can turn them into an array and pass them to the `excludeUrls` plugin option, or set `sitemap.exclude` to `true` in the frontmatter of the corresponding page.
If you don't want certain pages to appear in the sitemap, you can turn their paths into an array and pass to the `excludePaths` plugin option, or set `sitemap` to `false` in the frontmatter of the corresponding page.

## Output Location

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/sitemap/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

- 示例:`['/about.html', '/api/']`

## excludeUrls
## excludePaths

- 类型:`string[]`
- 默认值:`['/404.html']`
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/sitemap/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

如果你希望在 VuePress 项目页面之外,添加其他页面链接到 Sitemap,请将它们变成数组传入插件的 `extraUrls` 选项。

如果你需要排除一些链接,你可以将它们变成数组传入到插件的 `excludeUrls` 选项。你也可以在对应页面的 frontmatter 中,设置 `sitemap.exclude``true`
如果你需要排除一些页面路径,你可以将它们变成数组传入到插件的 `excludePaths` 选项。你也可以在对应页面的 frontmatter 中,设置 `sitemap``false`

## 输出位置

Expand Down
2 changes: 1 addition & 1 deletion e2e/docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default defineUserConfig({
sitemap: {
devServer: true,
devHostname: 'https://ecosystem-e2e-test.com',
excludeUrls: ['/sitemap/config-exclude.html', '/404.html'],
excludePaths: ['/sitemap/config-exclude.html', '/404.html'],
},
},
}),
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-sitemap/src/node/getInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const getSitemapInfos = (
): [path: string, info: SitemapInfo][] => {
const {
changefreq = 'daily',
excludeUrls = ['/404.html'],
excludePaths = ['/404.html'],
modifyTimeGetter = (page: Page<{ git?: GitData }>): string =>
page.data.git?.updatedTime
? new Date(page.data.git.updatedTime).toISOString()
Expand Down Expand Up @@ -74,7 +74,7 @@ export const getSitemapInfos = (
.map((content) => content.trim())
.includes('noindex') ||
// exclude in plugin options
excludeUrls.includes(page.path)
excludePaths.includes(page.path)
)
return

Expand Down
6 changes: 3 additions & 3 deletions plugins/plugin-sitemap/src/typings/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export interface SitemapPluginOptions {
extraUrls?: string[]

/**
* Urls to be excluded
* Page paths to be excluded
*
* 不被收录的页面
* 不被收录的页面路径
*/
excludeUrls?: string[]
excludePaths?: string[]

/**
* Output filename, relative to dest folder
Expand Down

0 comments on commit 247c792

Please sign in to comment.