main-sitemap.xsl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="2.0"
  3. xmlns:html="http://www.w3.org/TR/REC-html40"
  4. xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
  5. xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
  6. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  7. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  8. <xsl:template match="/">
  9. <html xmlns="http://www.w3.org/1999/xhtml">
  10. <head>
  11. <title>XML Sitemap</title>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13. <style type="text/css">
  14. body {
  15. font-family: Helvetica, Arial, sans-serif;
  16. font-size: 13px;
  17. color: #545353;
  18. }
  19. table {
  20. border: none;
  21. border-collapse: collapse;
  22. }
  23. #sitemap tr:nth-child(odd) td {
  24. background-color: #eee !important;
  25. }
  26. #sitemap tbody tr:hover td {
  27. background-color: #ccc;
  28. }
  29. #sitemap tbody tr:hover td, #sitemap tbody tr:hover td a {
  30. color: #000;
  31. }
  32. #content {
  33. margin: 0 auto;
  34. width: 1000px;
  35. }
  36. .expl {
  37. margin: 18px 3px;
  38. line-height: 1.2em;
  39. }
  40. .expl a {
  41. color: #da3114;
  42. font-weight: 600;
  43. }
  44. .expl a:visited {
  45. color: #da3114;
  46. }
  47. a {
  48. color: #000;
  49. text-decoration: none;
  50. }
  51. a:visited {
  52. color: #777;
  53. }
  54. a:hover {
  55. text-decoration: underline;
  56. }
  57. td {
  58. font-size:11px;
  59. }
  60. th {
  61. text-align:left;
  62. padding-right:30px;
  63. font-size:11px;
  64. }
  65. thead th {
  66. border-bottom: 1px solid #000;
  67. }
  68. </style>
  69. </head>
  70. <body>
  71. <div id="content">
  72. <h1>XML Sitemap</h1>
  73. <p class="expl">
  74. Generated by <a href="https://yoa.st/1y5" target="_blank" rel="noopener noreferrer">Yoast</a> <a href="https://yoa.st/1y6" target="_blank" rel="noopener noreferrer">SEO</a>, this is an XML Sitemap, meant for consumption by search engines.<br/>
  75. You can find more information about XML sitemaps on <a href="http://sitemaps.org" target="_blank" rel="noopener noreferrer">sitemaps.org</a>.
  76. </p>
  77. <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) &gt; 0">
  78. <p class="expl">
  79. This XML Sitemap Index file contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps.
  80. </p>
  81. <table id="sitemap" cellpadding="3">
  82. <thead>
  83. <tr>
  84. <th width="75%">Sitemap</th>
  85. <th width="25%">Last Modified</th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
  90. <xsl:variable name="sitemapURL">
  91. <xsl:value-of select="sitemap:loc"/>
  92. </xsl:variable>
  93. <tr>
  94. <td>
  95. <a href="{$sitemapURL}"><xsl:value-of select="sitemap:loc"/></a>
  96. </td>
  97. <td>
  98. <xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)),concat(' ', substring(sitemap:lastmod,20,6)))"/>
  99. </td>
  100. </tr>
  101. </xsl:for-each>
  102. </tbody>
  103. </table>
  104. </xsl:if>
  105. <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) &lt; 1">
  106. <p class="expl">
  107. This XML Sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
  108. </p>
  109. <table id="sitemap" cellpadding="3">
  110. <thead>
  111. <tr>
  112. <th width="80%">URL</th>
  113. <th width="5%">Images</th>
  114. <th title="Last Modification Time" width="15%">Last Mod.</th>
  115. </tr>
  116. </thead>
  117. <tbody>
  118. <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
  119. <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  120. <xsl:for-each select="sitemap:urlset/sitemap:url">
  121. <tr>
  122. <td>
  123. <xsl:variable name="itemURL">
  124. <xsl:value-of select="sitemap:loc"/>
  125. </xsl:variable>
  126. <a href="{$itemURL}">
  127. <xsl:value-of select="sitemap:loc"/>
  128. </a>
  129. </td>
  130. <td>
  131. <xsl:value-of select="count(image:image)"/>
  132. </td>
  133. <td>
  134. <xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)),concat(' ', substring(sitemap:lastmod,20,6)))"/>
  135. </td>
  136. </tr>
  137. </xsl:for-each>
  138. </tbody>
  139. </table>
  140. </xsl:if>
  141. </div>
  142. </body>
  143. </html>
  144. </xsl:template>
  145. </xsl:stylesheet>