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:

<?xml-stylesheet type="text/xsl" href="/sitemap.xsl"?>

und zwar noch vor der folgenden Zeile:

<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:

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

Autor: , veröffentlicht: , letzte Änderung:

Kontakt

Copyright / License of sources

Copyright (c) 2007-2017, Udo Schmal <udo.schmal@t-online.de>

Permission to use, copy, modify, and/or distribute the software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Service Infos

CMS Info Product Name:
UDOs Webserver
Version:
0.3.2.152
Description:
All in one Webserver
Copyright:
Udo Schmal
Compilation:
Sa, 23 Jun 2018 00:21:47
Development Info IDE:
Lazarus LCL 1.9.0.0
Compiler:
Free Pascal FPC 3.1.1
compiled for:
OS:Win64, CPU:x86_64
Hardware Info Model:
Precision WorkStation T3500
CPU Name:
Intel(R) Xeon(R) CPU W3530 @ 2.80GHz
CPU Type:
x86_64, 1 physical CPU(s), 4 Core(s), 8 logical CPU(s), 2800 MHz