Order and much more tags

master
Nick Sergeant 2012-06-20 11:26:27 -04:00
parent a364ffe52b
commit f70291e8fb
2 changed files with 11 additions and 12 deletions

View File

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://snipt.net/api/</loc>
<url>
<loc>https://snipt.net/api/</loc>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://snipt.net/todo/</loc>
<url>
<loc>https://snipt.net/todo/</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://snipt.net/public/</loc>
<url>
<loc>https://snipt.net/public/</loc>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://blog.snipt.net/</loc>
<url>
<loc>https://blog.snipt.net/</loc>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
{% for tag in tags %}
<url>
<loc>https://snipt.net/public/tag/{{ tag.slug }}</loc>
<url>
<loc>https://snipt.net/public/tag/{{ tag.slug }}</loc>
<priority>0.9</priority>
</url>
{% endfor %}

View File

@ -10,8 +10,7 @@ def sitemap(request):
tags = Tag.objects.filter(snipt__public=True)
tags = tags.annotate(count=Count('taggit_taggeditem_items__id'))
tags = tags.order_by('-count')[:50]
tags = sorted(tags, key=lambda tag: tag.name)
tags = tags.order_by('-count')[:1000]
return render_to_response('sitemap.xml',
{'tags': tags},