summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-02-22 20:44:24 -0600
committerluxagraf <sng@luxagraf.net>2019-02-22 20:44:24 -0600
commit5813a02145c8f95c04a2fedfd9555b402d443e6b (patch)
treec41dfa15aa4d4e50b928c514526216f84c9921cc
parent24e0c4ee694c694db2a6d038e5b509aed8e66b13 (diff)
added essays and books to sitemap, moved books to read
-rw-r--r--app/books/migrations/0008_auto_20190222_2140.py19
-rw-r--r--app/books/models.py15
-rw-r--r--app/essays/models.py6
-rw-r--r--config/base_urls.py8
4 files changed, 40 insertions, 8 deletions
diff --git a/app/books/migrations/0008_auto_20190222_2140.py b/app/books/migrations/0008_auto_20190222_2140.py
new file mode 100644
index 0000000..eb253c2
--- /dev/null
+++ b/app/books/migrations/0008_auto_20190222_2140.py
@@ -0,0 +1,19 @@
+# Generated by Django 2.1.5 on 2019-02-22 21:40
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('books', '0007_auto_20190131_2351'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='book',
+ name='body_markdown',
+ field=models.TextField(blank=True, default=''),
+ preserve_default=False,
+ ),
+ ]
diff --git a/app/books/models.py b/app/books/models.py
index 8e381ef..5df74f1 100644
--- a/app/books/models.py
+++ b/app/books/models.py
@@ -2,6 +2,7 @@ import os
from PIL import Image
from django.db import models
from django.db.models.signals import post_save
+from django.contrib.sitemaps import Sitemap
from django.dispatch import receiver
from django.urls import reverse
from django.apps import apps
@@ -23,7 +24,7 @@ class Book(models.Model):
slug = models.CharField(max_length=50)
read_date = models.DateTimeField()
isbn = models.CharField(max_length=100, blank=True, null=True)
- body_markdown = models.TextField(null=True, blank=True)
+ body_markdown = models.TextField(blank=True)
body_html = models.TextField(null=True, blank=True)
read_in = models.TextField(null=True, blank=True)
url = models.CharField(max_length=200, blank=True, null=True)
@@ -114,3 +115,15 @@ class BookHighlight(models.Model):
def body_html(self):
return markdown_to_html(self.body_markdown)
+
+
+class BookSitemap(Sitemap):
+ changefreq = "never"
+ priority = 0.7
+ protocol = "https"
+
+ def items(self):
+ return Book.objects.filter(is_public=True).exclude(body_markdown='')
+
+ def lastmod(self, obj):
+ return obj.read_date
diff --git a/app/essays/models.py b/app/essays/models.py
index 6160165..32ed053 100644
--- a/app/essays/models.py
+++ b/app/essays/models.py
@@ -79,13 +79,11 @@ class Essay(models.Model):
class EssaySitemap(Sitemap):
changefreq = "never"
- priority = 0.7
+ priority = 1.0
protocol = "https"
def items(self):
- return list(chain(
- Essay.objects.all(),
- ))
+ return Essay.objects.filter(status=1)
def lastmod(self, obj):
return obj.pub_date
diff --git a/config/base_urls.py b/config/base_urls.py
index f8848da..ad830db 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -10,7 +10,8 @@ from jrnl.views import HomepageList
from locations.models import WritingbyCountrySitemap
from photos.models import PhotoGallerySitemap
from src.models import SrcSitemap
-from figments.models import FigmentSitemap
+from books.models import BookSitemap
+from essays.models import EssaySitemap
from projects.models.base import ProjectSitemap
import builder.views
import utils.views
@@ -26,7 +27,8 @@ sitemaps = {
'photos': PhotoGallerySitemap,
'projects': ProjectSitemap,
'src': SrcSitemap,
- 'figments': FigmentSitemap
+ 'essays': EssaySitemap,
+ 'books': BookSitemap,
}
urlpatterns = [
@@ -44,7 +46,7 @@ urlpatterns = [
path(r'locations/', include('locations.urls')),
path(r'expenses/', include('expenses.urls', namespace='expenses')),
path(r'photos/', include('photos.urls')),
- path(r'books/', include('books.urls')),
+ path(r'reading/', include('books.urls')),
path(r'people/', include('people.urls')),
path(r'dialogues/', include('sightings.urls', namespace='sightings')),
path(r'field-notes/', include('sketches.urls', namespace='sketches')),