|
18 | 18 | <xsl:param name="docs-dir" as="xs:string" select="'/docs'"/> |
19 | 19 | <xsl:param name="rdf-dir" as="xs:string" select="'/rdf'"/> |
20 | 20 | <xsl:param name="output-folder" as="xs:string" select="'/output'"/> |
| 21 | + <xsl:param name="site-base-url" as="xs:string" select="'https://atomgraph.github.io/LinkedDataHub/linkeddatahub/docs/'"/> |
21 | 22 |
|
22 | 23 | <!-- all RDF/XML documents — sidecar for nav and child discovery only --> |
23 | 24 | <xsl:variable name="all-docs" select="collection('file://' || $rdf-dir || '?select=*.rdf;recurse=yes;content-type=application/xml')"/> |
|
29 | 30 | match="json:map/json:array[@key='files']/json:map" |
30 | 31 | use="json:string[@key='sha1']"/> |
31 | 32 |
|
| 33 | + <!-- doc path → source .ttl modification time --> |
| 34 | + <xsl:variable name="timestamps-xml" select="document('file://' || $docs-dir || '/timestamps.xml')"/> |
| 35 | + |
| 36 | + <xsl:key name="timestamp-by-path" match="json:string" use="@key"/> |
| 37 | + |
32 | 38 | <!-- |
33 | 39 | Derive the logical resource URI from a node's document base URI. |
34 | 40 | riot outputs the main resource as rdf:about="" (relative to base), so we cannot |
|
84 | 90 | </body> |
85 | 91 | </html> |
86 | 92 | </xsl:result-document> |
| 93 | + |
| 94 | + <!-- sitemap.xml --> |
| 95 | + <xsl:result-document href="{$output-folder}/sitemap.xml" method="xml" indent="yes"> |
| 96 | + <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
| 97 | + <url> |
| 98 | + <loc><xsl:value-of select="$site-base-url"/></loc> |
| 99 | + </url> |
| 100 | + <xsl:for-each select="$timestamps-xml/json:map/json:string"> |
| 101 | + <xsl:sort select="@key"/> |
| 102 | + <url> |
| 103 | + <loc><xsl:value-of select="$site-base-url || substring-after(@key, '/')"/></loc> |
| 104 | + <lastmod><xsl:value-of select="."/></lastmod> |
| 105 | + </url> |
| 106 | + </xsl:for-each> |
| 107 | + </urlset> |
| 108 | + </xsl:result-document> |
87 | 109 | </xsl:template> |
88 | 110 |
|
89 | 111 | <!-- ==================== ONE PAGE PER RDF DOCUMENT ==================== --> |
|
98 | 120 | <xsl:call-template name="html-head"> |
99 | 121 | <xsl:with-param name="title" select="$resource/dct:title"/> |
100 | 122 | <xsl:with-param name="description" select="$resource/dct:description"/> |
| 123 | + <xsl:with-param name="doc-path" select="$base-path"/> |
101 | 124 | </xsl:call-template> |
102 | 125 | <body> |
103 | 126 | <xsl:call-template name="navbar"> |
|
262 | 285 | <xsl:template name="html-head"> |
263 | 286 | <xsl:param name="title" as="xs:string"/> |
264 | 287 | <xsl:param name="description" as="xs:string?"/> |
| 288 | + <xsl:param name="doc-path" as="xs:string?"/> |
265 | 289 | <head> |
266 | 290 | <title>LinkedDataHub v5 — <xsl:value-of select="$title"/></title> |
267 | 291 | <xsl:if test="$description"> |
268 | 292 | <meta name="description" content="{$description}"/> |
269 | 293 | </xsl:if> |
| 294 | + <xsl:variable name="modified" select="key('timestamp-by-path', $doc-path, $timestamps-xml)"/> |
| 295 | + <xsl:if test="$modified"> |
| 296 | + <meta name="last-modified" content="{$modified}"/> |
| 297 | + </xsl:if> |
270 | 298 | <link href="https://atomgraph.github.io/LinkedDataHub/linkeddatahub/docs/files/css/bootstrap.css" rel="stylesheet" type="text/css"/> |
271 | 299 | <link href="https://atomgraph.github.io/LinkedDataHub/linkeddatahub/docs/files/css/bootstrap-responsive.css" rel="stylesheet" type="text/css"/> |
272 | 300 | <link href="https://atomgraph.github.io/LinkedDataHub/linkeddatahub/docs/files/css/linkeddatahub-bootstrap.css" rel="stylesheet" type="text/css"/> |
|
0 commit comments