Skip to content

Commit 8d993f6

Browse files
committed
Add links pages to sitemap
1 parent d3e8510 commit 8d993f6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/routes/sitemap[.]xml.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getAll, initialize } from "~/components/Patterns";
2+
import { MIN_ARCHIVE_YEAR } from "~/util/constants";
23

34
function urlLine(url:string) {
45
return `\t<url><loc>https://www.regex.zone${url}</loc></url>`
@@ -22,6 +23,17 @@ export async function loader() {
2223
lines.push(urlLine(`/patterns/${entry.handle}/`));
2324
}
2425

26+
lines.push(urlLine('/links/'));
27+
lines.push(urlLine('/links/tags.html'));
28+
lines.push(urlLine('/links/archive/'));
29+
const currentYear = new Date().getFullYear();
30+
for (let year = MIN_ARCHIVE_YEAR; year <= currentYear; year++) {
31+
if (year == 2010) {
32+
continue; // hack since no links in 2010
33+
}
34+
lines.push(urlLine(`/links/archive/${year}/`));
35+
}
36+
2537
lines.push('</urlset>')
2638

2739
return new Response(lines.join('\n'), {

0 commit comments

Comments
 (0)