2017-02-04 4 views
0

ディープリンクを有効にするために既存のサイトマップテンプレートをオーバーライドしようとしましたが、xmlにレスポンスフォーマットはありません。 urls.pydjango sitemapカスタムテンプレートのレスポンスフォーマットが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/">

関連する問題