templates/bundles/SuluWebsiteBundle/Sitemap/sitemap.xml.twig line 1

Open in your IDE?
  1. {% apply spaceless %}
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <urlset xmlns:xhtml="http://www.w3.org/1999/xhtml"
  4.         {% block namespaces %}
  5.             xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  6.             xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
  7.         {% endblock %}>
  8.     {% for entry in entries %}
  9.         {% set location = entry.loc %}
  10.         {% if domain in location %}
  11.             <url>
  12.                 {% block url %}
  13.                     {% block loc %}
  14.                         <loc>{{ location }}</loc>
  15.                     {% endblock %}
  16.                     {% block lastmod %}
  17.                         {% if entry.lastmod %}
  18.                             <lastmod>{{ entry.lastmod|date('Y-m-d') }}</lastmod>
  19.                         {% endif %}
  20.                     {% endblock %}
  21.                     {% block changefreq %}
  22.                         {% if entry.changefreq %}
  23.                             <changefreq>{{ entry.changefreq }}</changefreq>
  24.                         {% endif %}
  25.                     {% endblock %}
  26.                     {% block priority %}
  27.                         {% if entry.priority %}
  28.                             <priority>{{ entry.priority }}</priority>
  29.                         {% endif %}
  30.                     {% endblock %}
  31.                     {% block image %}
  32.                         {% if entry.images is defined %}
  33.                             {% for image in  entry.images %}
  34.                                 <image:image>
  35.                                     <image:loc>{{ image.location }}</image:loc>
  36.                                 </image:image>
  37.                             {% endfor %}
  38.                         {% endif %}
  39.                     {% endblock %}
  40.                     {% block alternateLinks %}
  41.                         {% if entry.alternateLinks|length > 1 %}
  42.                             {% for alternateLink in entry.alternateLinks %}
  43.                                 {% set href = alternateLink.href %}
  44.                                 {% if href is not empty and domain in href %}
  45.                                     <xhtml:link rel="alternate" hreflang="{{ alternateLink.locale|replace({'_': '-'}) }}" href="{{ href }}"/>
  46.                                 {% endif %}
  47.                             {% endfor %}
  48.                         {% endif %}
  49.                     {% endblock %}
  50.                 {% endblock %}
  51.             </url>
  52.         {% endif %}
  53.     {% endfor %}
  54. </urlset>
  55. {% endapply %}