Commit 718dfd1
committed
Filter the sitemap on noindex rather than on directory name
The exclusion list was growing one framework route at a time. #123
added 404 after it appeared in the sitemap; this branch added _not-found
for the same reason; and the versioned-docs work in progress adds a
third hand-written skip for the archived version directories. Each is
the same rule discovered again: do not advertise a page that tells
crawlers not to index it.
That property is readable from the page itself, so collectPages now
reads each index.html and skips the ones carrying a noindex robots meta.
The name list keeps only the directories that hold no pages at all -
_next, deb, rpm, images - where it is a traversal concern rather than an
indexing decision.
The tag is matched in either attribute order and tolerates content lists
such as "noindex,nofollow", since Next.js and hand-written metadata do
not agree on either. The final log line now reports how many pages were
skipped, so a filter that starts matching too much is visible in the
build output instead of silently shrinking the sitemap.
Verified against a synthetic export carrying an indexable root, /docs,
/docs/versions, /packages and /samples, plus three noindex pages written
in three different tag forms and an excluded _next directory: five URLs
emitted, three skipped, and out/404.html left alone as the file it is.
Note that the archived-version case is now covered by this rule, so the
docs/versions skip on the versioned-docs branch can go when it lands.1 parent 3913fae commit 718dfd1
1 file changed
Lines changed: 41 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | | - | |
30 | | - | |
31 | 33 | | |
32 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
33 | 49 | | |
34 | 50 | | |
35 | 51 | | |
| |||
49 | 65 | | |
50 | 66 | | |
51 | 67 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
56 | 76 | | |
57 | 77 | | |
58 | 78 | | |
| |||
117 | 137 | | |
118 | 138 | | |
119 | 139 | | |
120 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
0 commit comments