Skip to content

Commit

Permalink
Merge pull request #665 from iamvishnusankar/fix/exclude-favicon-route
Browse files Browse the repository at this point in the history
[Feat] Exclude favicon from sitemaps
  • Loading branch information
iamvishnusankar committed Jul 1, 2023
2 parents dd3a619 + 46c5e3c commit b951757
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -13,7 +13,7 @@ jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
platform: [ubuntu-latest, macos-latest] # windows-latest]
node: ['16', '18']
runs-on: ${{ matrix.platform }}
steps:
Expand Down
Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion .yarnrc.yml
Expand Up @@ -27,4 +27,4 @@ supportedArchitectures:
- current
- darwin
- linux
- win32
- windows
1 change: 1 addition & 0 deletions packages/next-sitemap/src/utils/__tests__/url.test.ts
Expand Up @@ -47,6 +47,7 @@ describe('next-sitemap/url', () => {
expect(isNextInternalUrl('/about/_middleware')).toBeTruthy()
expect(isNextInternalUrl('/some_url/about/_middleware')).toBeTruthy()
expect(isNextInternalUrl('/projects/[id]/_middleware')).toBeTruthy()
expect(isNextInternalUrl('/favicon.ico')).toBeTruthy()
})

test('isNextInternalUrl: url params', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/next-sitemap/src/utils/url.ts
Expand Up @@ -16,9 +16,9 @@ export const generateUrl = (baseUrl: string, slug: string): string => {
* @param path path check
*/
export const isNextInternalUrl = (path: string): boolean => {
return new RegExp(/[^/]*^.[_]|^\/(404|500)$|\/_middleware$|(?:\[)/g).test(
path
)
return new RegExp(
/[^/]*^.[_]|^\/(404|500)$|\/_middleware$|favicon.ico|(?:\[)/g
).test(path)
}

/**
Expand Down

0 comments on commit b951757

Please sign in to comment.