Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request enhances the
Sitemapper
class by adding support for URL exclusion patterns and includes corresponding unit tests to ensure the new functionality works as expected.Use Case
To enable filtering unwanted sitemap indexes/urls. Example: https://www.slamcity.com/sitemap.xml contains the same urls but in 20+ languages. Attempting to parse this sitemap as is causes
Error fetching sitemap: Maximum call stack size exceeded
Enhancements to
Sitemapper
class:exclusions
option to the constructor, allowing users to specify an array of regex patterns to exclude certain URLs. (src/assets/sitemapper.js
) [1] [2]isExcluded
method to check if a URL matches any of the exclusion patterns. (src/assets/sitemapper.js
)Sitemapper
class to use theisExcluded
method, ensuring excluded URLs are filtered out during sitemap processing. (src/assets/sitemapper.js
) [1] [2]Unit tests for exclusions:
exclusions
option to verify that URLs matching the exclusion patterns are correctly filtered out. (src/tests/test.js
)isExcluded
method to ensure it handles various scenarios, including no exclusions, matching and non-matching URLs, complex regex patterns, and case sensitivity. (src/tests/test.js
)