Skip to content

Commit fe12bc2

Browse files
authored
[bugfix] force the initial path to be included in the crawling (#99)
1 parent 9a4fda6 commit fe12bc2

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

.changeset/spotty-snakes-fry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'lighthouse-parade': patch
3+
---
4+
5+
Force the initial path to be included in the crawling regardless of include/exclude flags

crawl.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@ export const crawl = (siteUrl: string, opts: CrawlOptions) => {
3535
crawler.respectRobotsTxt = !opts.ignoreRobotsTxt;
3636
if (opts.maxCrawlDepth !== undefined) crawler.maxDepth = opts.maxCrawlDepth;
3737

38+
const initialPath = new URL(siteUrl).pathname;
39+
3840
crawler.addFetchCondition(
39-
createUrlFilter(opts.includePathGlob, opts.excludePathGlob)
41+
createUrlFilter(
42+
[...opts.includePathGlob, initialPath],
43+
opts.excludePathGlob
44+
)
4045
);
4146

4247
const emitWarning = (queueItem: QueueItem, response: IncomingMessage) => {

0 commit comments

Comments
 (0)