File tree Expand file tree Collapse file tree 1 file changed +24
-15
lines changed
Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Original file line number Diff line number Diff line change 1- """Whitelist for pages to build."""
1+ """A list of whitelist paths that should be built.
2+ If the list is empty, all pages will be built.
23
3- from typing import List
4+ Tips:
5+ - Ensure that the path starts with a forward slash '/'.
6+ - Do not include a trailing slash '/' at the end of the path.
47
5- # Add pages to whitelist here.
6- # This will significantly improve performance during development.
7- WHITELISTED_PAGES : List [str ] = []
8+ Examples:
9+ - Correct: WHITELISTED_PAGES = ["/docs/getting-started/introduction"]
10+ - Incorrect: WHITELISTED_PAGES = ["/docs/getting-started/introduction/"]
11+ """
812
13+ WHITELISTED_PAGES = []
914
10- def _check_whitelisted_path (path : str ) -> bool :
11- """Check if a path is whitelisted.
12-
13- Args:
14- path: The path to check.
15+ def _check_whitelisted_path (path : str ):
16+ if len (WHITELISTED_PAGES ) == 0 :
17+ return True
1518
16- Returns:
17- Whether the path is whitelisted.
18- """
19- if not WHITELISTED_PAGES :
19+ # If the path is the root, always build it.
20+ if path == "/" :
2021 return True
21- return path in WHITELISTED_PAGES
22+
23+ if len (WHITELISTED_PAGES ) == 1 and WHITELISTED_PAGES [0 ] == "/" :
24+ return False
25+
26+ for whitelisted_path in WHITELISTED_PAGES :
27+ if path .startswith (whitelisted_path ):
28+ return True
29+
30+ return False
You can’t perform that action at this time.
0 commit comments