Skip to content

Commit

Permalink
Generate static sitemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
gpkvt committed Dec 15, 2023
1 parent aa5d6bf commit 6b3a207
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
6 changes: 2 additions & 4 deletions fragdenstaat_de/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-12 09:08-0500\n"
"POT-Creation-Date: 2023-12-15 04:20-0600\n"
"PO-Revision-Date: 2023-10-12 16:09+0200\n"
"Last-Translator: Karl Engelhardt <karl.engelhardt@okfn.de>\n"
"Language-Team: German <https://weblate.frag-den-staat.de/projects/froide/"
Expand Down Expand Up @@ -772,7 +772,6 @@ msgstr "Organisationen"
msgid "No organizations found."
msgstr "Keine Organisation gefunden."

#. Translators: meta keywords
#: fragdenstaat_de/templates/snippets/meta.html
msgid ""
"Freedom of Information Requests, Freedom of Information Law, Public Body "
Expand All @@ -782,8 +781,7 @@ msgstr ""
"Behördeninformationen"

#~ msgid "You like our work? Support us with a donation!"
#~ msgstr ""
#~ "Ihnen gefällt unsere Arbeit? Unterstützen Sie uns mit einer Spende!"
#~ msgstr "Ihnen gefällt unsere Arbeit? Unterstützen Sie uns mit einer Spende!"

#~ msgid "Donate now"
#~ msgstr "Jetzt spenden"
Expand Down
38 changes: 27 additions & 11 deletions fragdenstaat_de/theme/management/commands/render_sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,33 @@ class Command(BaseCommand):
help = "Render sitemap"

def add_arguments(self, parser):
parser.add_argument("section", help="Render section", default="")
parser.add_argument(
"--section", help="Render section", default="", required=False
)
parser.add_argument(
"--getsections",
help="List available sections",
required=False,
action="store_true",
)

def handle(self, *args, **options):
section = options["section"]
factory = RequestFactory()
if section:
request = factory.get("/sitemap-{}.xml".format(section))
response = sitemaps_views.sitemap(request, sitemaps)
if options["getsections"]:
for section in sitemaps:
self.stdout.write(section)
else:
request = factory.get("/sitemap.xml")
response = sitemaps_views.index(
request, sitemaps, sitemap_url_name="sitemaps"
)
self.stdout.write(response.rendered_content)
section = options["section"]
factory = RequestFactory()
if section:
sitemap_name = "/sitemap-{}.xml".format(section)
request = factory.get(sitemap_name)
response = sitemaps_views.sitemap(request, sitemaps)
else:
sitemap_name = "/sitemap.xml"
request = factory.get(sitemap_name)
response = sitemaps_views.index(
request, sitemaps, sitemap_url_name="sitemaps"
)
sitemap_dest_tmp = "/tmp/{}".format(sitemap_name)
with open(sitemap_dest_tmp, "w") as sitemap_out:
sitemap_out.write(response.rendered_content)

0 comments on commit 6b3a207

Please sign in to comment.