add meta description

This commit is contained in:
Jonas Heinrich 2025-05-10 12:41:52 +02:00
parent eee8494001
commit 3086d63cc7
5 changed files with 31 additions and 10 deletions

View file

@ -7,6 +7,7 @@ from .models import GovernmentPlanUpdate, GovernmentPlan
import re
def strip_html_tags(text):
text = text.decode('utf-8')
tag_re = re.compile(r'<[^>]+>')
return tag_re.sub('', text)
@ -21,10 +22,10 @@ def post_to_mastodon(text):
def send_mastodon_toot_update(sender, instance, created, **kwargs):
if created and instance.public:
transaction.on_commit(lambda: post_to_mastodon(
f"📢 Neue Entwicklung im Verwaltungsvorhaben: {instance.plan.title}!\n"
f"📢 Neue Entwicklung im Verwaltungsvorhaben: {instance.plan.title}!\n\n"
f"{instance.title}: {strip_html_tags(instance.content)}\n\n"
f"🔗 Primärquelle: {instance.plan.reference}\n"
f"📋 Verwaltungstracker-Eintrag: {instance.plan.get_absolute_domain_url()}\n"
f"📋 Verwaltungstracker-Eintrag: {instance.plan.get_absolute_domain_url()}\n\n"
f"#karlsruhe"
))
@ -34,6 +35,6 @@ def send_mastodon_toot_plan(sender, instance, created, **kwargs):
transaction.on_commit(lambda: post_to_mastodon(
f"📢 Neues Verwaltungsvorhaben '{instance.title}' wurde aufgenommen.\n\n"
f"🔗 Primärquelle: {instance.reference}\n"
f"📋 Verwaltungstracker-Eintrag: {instance.get_absolute_domain_url()}\n"
f"📋 Verwaltungstracker-Eintrag: {instance.get_absolute_domain_url()}\n\n"
f"#karlsruhe"
))