forked from gnyylmz/BlogProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsitemaps.py
More file actions
28 lines (24 loc) · 788 Bytes
/
sitemaps.py
File metadata and controls
28 lines (24 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# sitemaps.py
from django.contrib import sitemaps
from .models import post,category
class StaticViewSitemap(sitemaps.Sitemap):
priority = 0.5
changefreq = 'daily'
def sitemap_db(self):
# post ve category urlleri aliyorum.
try:
url_list = []
post_db = post.objects.all()
for i in post_db:
url_list.append('/' + i.seo_url)
category_db = category.objects.all()
for i in category_db:
url_list.append('/kategori/' + i.seo_url)
return url_list
except:
url_list = []
return url_list
def items(self):
return ['','/hakkimda','/iletisim','/anasayfa']+self.sitemap_db()
def location(self, item):
return item