Sitemap
parent
ce25e7a724
commit
c90c61d782
|
@ -1,8 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1"
|
||||
xmlns:video="http://www.sitemaps.org/schemas/sitemap-video/1.1">
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc></loc>
|
||||
<loc>https://snipt.net/api/</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://snipt.net/todo/</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://snipt.net/public/</loc>
|
||||
<changefreq>always</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<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>
|
||||
<priority>0.9</priority>
|
||||
</url>
|
||||
{% endfor %}
|
||||
</urlset>
|
||||
|
|
10
views.py
10
views.py
|
@ -2,11 +2,19 @@ from django.shortcuts import render_to_response
|
|||
from annoying.decorators import ajax_request
|
||||
from django.template import RequestContext
|
||||
from snipts.utils import get_lexers_list
|
||||
from django.db.models import Count
|
||||
from taggit.models import Tag
|
||||
|
||||
|
||||
def sitemap(request):
|
||||
|
||||
tags = Tag.objects.filter(snipt__public=True)
|
||||
tags = tags.annotate(count=Count('taggit_taggeditem_items__id'))
|
||||
tags = tags.order_by('-count')[:20]
|
||||
tags = sorted(tags, key=lambda tag: tag.name)
|
||||
|
||||
return render_to_response('sitemap.xml',
|
||||
{},
|
||||
{'tags': tags},
|
||||
context_instance=RequestContext(request),
|
||||
mimetype='application/xml')
|
||||
|
||||
|
|
Loading…
Reference in New Issue