Es gibt einige Gestaltungsmöglichkeiten für XML-Dateien, also auch für die Google Sitemap (/sitemap.xml) wie z.B. Google Sitemaps Toolbox, doch auch nur mit einer XSL-Datei, die natürlich in der Sitemap referenziert werden muss, gibt es ein ansprechendes Ergebnis.
Beispiel: /sitemap.xml, /sitemap.xsl
![]() sitemap.xml ohne sitemap.xsl |
![]() sitemap.xml mit sitemap.xsl |
In der sitemap.xml Datei muss dazu lediglich eine Zeile eingefügt werden und zwar for dem urlset:
<?xml-stylesheet type="text/xsl" href="/sitemap.xsl"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" />
Das Stylesheet sitemap.xsl sieht dann volgendermaßen aus:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output omit-xml-declaration="no" method="xml" version="1.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Sitemap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">body {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
#header, #footer {background-color: #f7f7f7; border: 1px solid #aaaaaa; border-right: none; border-left: none; padding: 5px 10px; margin: 10px 0; line-height: 1.7;}
#footer {margin-top: 15px;}
table {width: 100%;}
th {text-align: left; border-bottom: 1px solid #aaaaaa; padding-bottom: 10px; padding-left: 5px;}
tr.odd {background-color: #f7f7f7;}
td {padding: 5px; margin: 0;}</style>
</head>
<body>
<h1>XML Sitemap from www.gocher.me</h1>
<div id="header">
<p>This sitemap was created using UDOs Webserver 0.2.3.14 developed by Udo Schmal.</p>
</div>
<div id="content">
<table cellspacing="0" cellpadding="0">
<tr>
<th style="width: 60%;">Location</th>
<th>Priority</th>
<th>Change Frequency</th>
<th>Last Modified (GMT)</th>
</tr>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:for-each select="sitemap:urlset/sitemap:url">
<tr>
<xsl:if test="position() mod 2 != 0">
<xsl:attribute name="class">odd</xsl:attribute>
</xsl:if>
<td>
<xsl:variable name="itemURL">
<xsl:value-of select="sitemap:loc" />
</xsl:variable>
<a href="{$itemURL}">
<xsl:value-of select="sitemap:loc" />
</a>
</td>
<td>
<xsl:value-of select="concat(sitemap:priority*100,'%')" />
</td>
<td>
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))" />
</td>
<td>
<xsl:value-of select="concat(substring(sitemap:lastmod, 0, 11),concat(' ', substring(sitemap:lastmod, 12, 5)))" />
</td>
</tr>
</xsl:for-each>
</table>
</div>
<div id="footer">© Copyright 2016 Udo Schmal</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>