Skip to content

Commit

Permalink
Render alternate links.
Browse files Browse the repository at this point in the history
  • Loading branch information
igor committed Feb 26, 2016
1 parent 6eaa360 commit 4c6a634
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Resources/views/Sitemap/sitemap.xml.twig
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{% for url in urls %}
<url>
<loc>{{ url.location }}</loc>
{% if url.lastModifiedAt %}<lastmod>{{ url.lastModifiedAt | date('Y-m-d') }}</lastmod>{% endif %}

{% if url.changeFrequency %}<changefreq>{{ url.changeFrequency }}</changefreq>{% endif %}

{% if url.priority %}<priority>{{ url.priority | number_format(1) }}</priority>{% endif %}
{% if url.lastModifiedAt -%}
<lastmod>{{ url.lastModifiedAt | date('Y-m-d') }}</lastmod>
{% endif -%}
{% if url.changeFrequency -%}
<changefreq>{{ url.changeFrequency }}</changefreq>
{% endif -%}
{% if url.priority -%}
<priority>{{ url.priority | number_format(1) }}</priority>
{% endif -%}
{% for alternate_link in url.alternateLinks -%}
<xhtml:link rel="alternate" hreflang="{{ alternate_link.hrefLanguage }}" href="{{ alternate_link.href }}" />
{% endfor %}

</url>
{% endfor %}
Expand Down

0 comments on commit 4c6a634

Please sign in to comment.