Skip to content

Commit

Permalink
[Feat] Exclude favicon from sitemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvishnusankar committed Jul 1, 2023
1 parent dd3a619 commit ba104ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/next-sitemap/src/utils/__tests__/url.test.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 ba104ac

Please sign in to comment.