summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/locations/models.py2
-rw-r--r--app/src/models.py22
-rw-r--r--config/base_urls.py5
3 files changed, 27 insertions, 2 deletions
diff --git a/app/locations/models.py b/app/locations/models.py
index 9ae6b6a..1ac48cb 100644
--- a/app/locations/models.py
+++ b/app/locations/models.py
@@ -157,7 +157,7 @@ class WritingbyCountrySitemap(Sitemap):
protocol = "https"
def location(self, item):
- return '/writing/%s' % item.slug
+ return '/jrnl/%s' % item.slug
def items(self):
return Country.objects.filter(visited=True)
diff --git a/app/src/models.py b/app/src/models.py
index 9b596b1..6b5f476 100644
--- a/app/src/models.py
+++ b/app/src/models.py
@@ -1,6 +1,8 @@
from django.db import models
+from django.contrib.sitemaps import Sitemap
from blog.models import image_url_replace, extract_images
import markdown
+import datetime
class Topic(models.Model):
name = models.CharField(max_length=60)
@@ -10,6 +12,12 @@ class Topic(models.Model):
def __str__(self):
return self.name
+ def get_absolute_url(self):
+ return "/src/topic/%s" % (self.slug)
+
+ @property
+ def pub_date(self):
+ return datetime.datetime.now()
class Entry(models.Model):
title = models.CharField(max_length=200)
@@ -94,3 +102,17 @@ class Book(models.Model):
def get_absolute_url(self):
return "/src/books/%s" % (self.slug)
+
+from itertools import chain
+
+class SrcSitemap(Sitemap):
+ changefreq = "never"
+ priority = 0.7
+ protocol = "https"
+
+ def items(self):
+ return list(chain(Entry.objects.all(), Book.objects.all(), Topic.objects.all()))
+
+
+ def lastmod(self, obj):
+ return obj.pub_date
diff --git a/config/base_urls.py b/config/base_urls.py
index 9485a5b..83880fc 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -7,6 +7,7 @@ from blog.models import BlogSitemap, LatestFull
from locations.models import WritingbyCountrySitemap
from links.models import LatestLinks
from photos.models import PhotoGallerySitemap
+from src.models import SrcSitemap
from projects.models.base import ProjectSitemap
admin.autodiscover()
@@ -16,7 +17,8 @@ sitemaps = {
'blog': BlogSitemap,
'writingbyloc': WritingbyCountrySitemap,
'photos': PhotoGallerySitemap,
- 'projects': ProjectSitemap
+ 'projects': ProjectSitemap,
+ 'src': SrcSitemap
}
feeds = {
'writing': LatestFull,
@@ -60,6 +62,7 @@ urlpatterns += patterns('',
(r'^birds/', include('birds.urls')),
(r'^travel-guide/', include('guide.urls')),
(r'^src/', include('src.urls')),
+ (r'^figments/', include('figments.urls')),
# map
(r'^map/', include('locations.urls')),
#about