Google Sitemap

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.xslzoom

sitemap.xml ohne sitemap.xsl

Sitemap.xml mit Sitemap.xslzoom

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"></urlset>

 Das Stylesheet sitemap.xsl sieht dann volgendermaßen aus:

sitemap.xsl XSL (2,99 kByte) 04.02.2016 22:50
<?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>

Author: , published: , last modified:

Kontakt

Udo Schmal
Udo Schmal

Udo Schmal
Softwareentwickler
Ellerndiek 26
24837 Schleswig
Schleswig-Holstein
Germany




+49 4621 9785538
+49 1575 0663676
+49 4621 9785539
SMS
WhatsApp

Google Maps Profile
Instagram Profile
vCard 3.0

Service Infos

CMS Info

Product Name:
UDOs Webserver
Version:
0.5.0.180
Description:
All in one Webserver
Copyright:
Udo Schmal
Compilation:
Mon, 13. Mar 2023 18:43:53

Development Info

Compiler:
Free Pascal FPC 3.3.1
compiled for:
OS:Linux, CPU:x86_64

System Info

OS:
Ubuntu 22.04.2 LTS (Jammy Jellyfish)

Hardware Info

Model:
Hewlett-Packard HP Pavilion dm4 Notebook PC
CPU Name:
Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
CPU Type:
x86_64, 1 physical CPU(s), 2 Core(s), 4 logical CPU(s),  MHz