diff options
author | luxagraf <sng@luxagraf.net> | 2023-12-17 08:39:39 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-12-17 08:39:39 -0500 |
commit | d627bd06951f6fe808b7409085bf774517bfbde3 (patch) | |
tree | 038f2fb2484f8b07fc5a98d1a71c67a187ec1c8f | |
parent | 15bb502dd3147d8ad96cc40f7cbc0e4c2cb68d11 (diff) |
jrnl: fixed sitemap build
-rw-r--r-- | app/builder/views.py | 5 | ||||
-rw-r--r-- | app/posts/build.py | 8 | ||||
-rw-r--r-- | config/base_urls.py | 4 |
3 files changed, 14 insertions, 3 deletions
diff --git a/app/builder/views.py b/app/builder/views.py index bb23686..211b585 100644 --- a/app/builder/views.py +++ b/app/builder/views.py @@ -6,7 +6,7 @@ from resume.build import pub_builder, resume_builder from books.build import builder as book_builder from sightings.build import builder as sightings_builder from pages.build import BuildPages, BuildHome -from posts.build import BuildJrnl, BuildFieldNotes, BuildSrc, BuildGuide, BuildEssays, BuildRange, BuildFriends, BuildFilms, BuildTrips +from posts.build import BuildJrnl, BuildFieldNotes, BuildSrc, BuildGuide, BuildEssays, BuildRange, BuildFriends, BuildFilms, BuildTrips, BuildSitemap def do_build(request): section = request.GET.get('id', '') @@ -22,6 +22,9 @@ def do_build(request): elif section == 'buildrss': context = {'message': 'Writing RSS to Disk'} BuildJrnl("posts", "post").build_feed("feed") + elif section == 'sitemap': + context = {'message': 'Writing Sitemap to Disk'} + BuildSitemap("posts", "post").build() elif section == 'homepage': context = {'message': 'Writing index to Disk'} BuildHome("pages", "homepage").build() diff --git a/app/posts/build.py b/app/posts/build.py index e5dc1ed..89d7c54 100644 --- a/app/posts/build.py +++ b/app/posts/build.py @@ -1,4 +1,5 @@ from django.urls import reverse +from django.test.client import Client from django.apps import apps from builder.base import BuildNew from itertools import chain @@ -176,3 +177,10 @@ class BuildTrips(BuildNew): paginate_by=30 ) self.build_detail_view() + + +class BuildSitemap(BuildNew): + def build(self): + c = Client() + response = c.get('/sitemap.xml', HTTP_HOST='127.0.0.1') + self.write_file('', response.content, 'xml', 'sitemap') diff --git a/config/base_urls.py b/config/base_urls.py index 1265e7b..67ce345 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -22,8 +22,8 @@ admin.autodiscover() sitemaps = { 'posts': PostSitemap, 'pages': PageSitemap, - 'writingbyloc': WritingbyCountrySitemap, - 'books': BookSitemap, + #'writingbyloc': WritingbyCountrySitemap, + #'books': BookSitemap, } urlpatterns = [ |