2017-02-04 17 views
0

Я пытаюсь переопределить существующий шаблон карты сайта, чтобы включить глубокую ссылку, но формат ответа не в xml. urls.pydjango sitemap custom template response format is not in xml

url(r'^sitemap\.xml$',sitemap,{'sitemaps':sitemaps,'template_name':'sitemaps/sitemap.xml','content_type':'application/xml'},name='django.contrib.sitemaps.views.sitemap') 

sitemap.xml

<?xml version="1.0" encoding="UTF-8"?> 
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 
xmlns:xhtml="http://www.w3.org/1999/xhtml"> 
{% spaceless %} 
{% for url in urlset %} 
<url> 
<loc>{{ url.location }}</loc> 
<xhtml:link rel="alternate" href="android-app://{{ url.location }}" /> 
{% if url.lastmod %}<lastmod>{{ url.lastmod|date:"Y-m-d" }}</lastmod> {% endif %} 
{% if url.changefreq %}<changefreq>{{ url.changefreq }}</changefreq>{% endif %} 
{% if url.priority %}<priority>{{ url.priority }}</priority>{% endif %} 
</url> 
{% endfor %} 
{% endspaceless %} 
</urlset> 

пожалуйста, помогите, я не получаю не решение от Google.

ответ

0

Добавив / в конце определения пространства имен, сработало для меня. Я использую этот тег: <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml/">

 Смежные вопросы

  • Нет связанных вопросов^_^