Skip to content

Commit e7ec7c2

Browse files
christophdbclaude
andcommitted
Add XSL stylesheet for human-readable sitemap rendering
Browser shows a styled HTML table sorted by priority, search engines continue to read the raw XML. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d7fbda9 commit e7ec7c2

3 files changed

Lines changed: 111 additions & 2 deletions

File tree

.github/workflows/rdme-openapi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ jobs:
125125
- name: Generate sitemap.xml, llms.txt, llms-full.txt
126126
run: python3 custom-domain/generate.py
127127

128-
- name: Copy robots.txt to output
129-
run: cp custom-domain/robots.txt custom-domain/output/
128+
- name: Copy static files to output
129+
run: cp custom-domain/robots.txt custom-domain/sitemap.xsl custom-domain/output/
130130

131131
- name: Setup SSH
132132
run: |

custom-domain/generate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def generate_sitemap(intro_pages, specs_data):
203203

204204
lines = [
205205
'<?xml version="1.0" encoding="UTF-8"?>',
206+
'<?xml-stylesheet type="text/xsl" href="/sitemap.xsl"?>',
206207
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">',
207208
]
208209
for url in sorted(seen):

custom-domain/sitemap.xsl

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet version="2.0"
3+
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
4+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
6+
<xsl:template match="/">
7+
<html xmlns="http://www.w3.org/1999/xhtml">
8+
<head>
9+
<title>XML Sitemap — api.seatable.com</title>
10+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11+
<style type="text/css">
12+
body {
13+
font-family: Helvetica, Arial, sans-serif;
14+
font-size: 13px;
15+
color: #545353;
16+
}
17+
table {
18+
border: none;
19+
border-collapse: collapse;
20+
}
21+
#sitemap tr:nth-child(odd) td {
22+
background-color: #eee !important;
23+
}
24+
#sitemap tbody tr:hover td {
25+
background-color: #ccc;
26+
}
27+
#sitemap tbody tr:hover td, #sitemap tbody tr:hover td a {
28+
color: #000;
29+
}
30+
#content {
31+
margin: 0 auto;
32+
width: 1000px;
33+
}
34+
.expl {
35+
margin: 18px 3px;
36+
line-height: 1.2em;
37+
}
38+
.expl a {
39+
color: #da3114;
40+
font-weight: 600;
41+
}
42+
a {
43+
color: #000;
44+
text-decoration: none;
45+
}
46+
a:visited {
47+
color: #777;
48+
}
49+
a:hover {
50+
text-decoration: underline;
51+
}
52+
td {
53+
font-size: 12px;
54+
padding: 4px;
55+
}
56+
th {
57+
text-align: left;
58+
padding-right: 30px;
59+
font-size: 12px;
60+
}
61+
thead th {
62+
border-bottom: 1px solid #000;
63+
}
64+
</style>
65+
</head>
66+
<body>
67+
<div id="content">
68+
<h1>XML Sitemap</h1>
69+
<p class="expl">
70+
This is the XML Sitemap for <a href="https://api.seatable.com">api.seatable.com</a>, meant for consumption by search engines.<br/>
71+
It contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
72+
You can find more information about XML sitemaps on <a href="https://sitemaps.org" target="_blank" rel="noopener">sitemaps.org</a>.
73+
</p>
74+
<table id="sitemap" cellpadding="3">
75+
<thead>
76+
<tr>
77+
<th width="70%">URL</th>
78+
<th width="15%">Priority</th>
79+
<th width="15%">Last Modified</th>
80+
</tr>
81+
</thead>
82+
<tbody>
83+
<xsl:for-each select="sitemap:urlset/sitemap:url">
84+
<xsl:sort select="sitemap:priority" order="descending" data-type="number"/>
85+
<tr>
86+
<td>
87+
<xsl:variable name="itemURL">
88+
<xsl:value-of select="sitemap:loc"/>
89+
</xsl:variable>
90+
<a href="{$itemURL}">
91+
<xsl:value-of select="sitemap:loc"/>
92+
</a>
93+
</td>
94+
<td>
95+
<xsl:value-of select="sitemap:priority"/>
96+
</td>
97+
<td>
98+
<xsl:value-of select="sitemap:lastmod"/>
99+
</td>
100+
</tr>
101+
</xsl:for-each>
102+
</tbody>
103+
</table>
104+
</div>
105+
</body>
106+
</html>
107+
</xsl:template>
108+
</xsl:stylesheet>

0 commit comments

Comments
 (0)