forked from mfitzp/smrtr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.py
101 lines (74 loc) · 2.11 KB
/
sitemap.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from django.contrib.sitemaps import Sitemap
# Smrtr
from network.models import Network
from challenge.models import Challenge
from package.models import Package
from profiles.models import UserProfile
from questions.models import Question
# External
from forum.models import Thread, Post
class NetworkSitemap(Sitemap):
changefreq = "monthly"
priority = 1
limit = 1000
def items(self):
return Network.objects.all()
def lastmod(self, obj):
return obj.updated
class PackageSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5
limit = 1000
def items(self):
return Package.objects.all()
def lastmod(self, obj):
return obj.updated
class ChallengeSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5
limit = 1000
def items(self):
return Challenge.objects.all()
def lastmod(self, obj):
return obj.updated
class PackageSitemap(Sitemap):
changefreq = "weekly"
priority = 1
limit = 1000
def items(self):
return Package.objects.all()
def lastmod(self, obj):
return obj.created
class UserProfileSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5
limit = 1000
def items(self):
return UserProfile.objects.all()
def lastmod(self, obj):
return obj.user.last_login
class QuestionSitemap(Sitemap):
changefreq = "monthly"
priority = 0.5
limit = 1000
def items(self):
return Question.objects.all()
def lastmod(self, obj):
return obj.updated
class ThreadSitemap(Sitemap):
changefreq = "weekly"
limit = 1000
def priority(self, obj):
return 0.5 + ( (obj.sticky + obj.system) * 0.25 ) # Increase priority to 1 when sticky and system
def items(self):
return Thread.objects.all()
def lastmod(self, obj):
return obj.latest_post_time
class PostSitemap(Sitemap):
changefreq = "never"
priority = 0.5
limit = 1000
def items(self):
return Post.objects.all()
def lastmod(self, obj):
return obj.time