Replace custom pagefullurl tag with built-in

This commit is contained in:
Jake Howard 2024-01-05 15:46:38 +00:00
parent 518461a88f
commit 8fe3cdbbc3
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 2 additions and 8 deletions

View file

@ -1,8 +1,8 @@
{% load util_tags %} {% load wagtailcore_tags %}
<section class="container has-text-centered shareon-container" id="shareon"> <section class="container has-text-centered shareon-container" id="shareon">
<p>Share this page</p> <p>Share this page</p>
<div class="shareon" data-title="{{ page.title }}" data-url="{% pagefullurl page %}"> <div class="shareon" data-title="{{ page.title }}" data-url="{% fullpageurl page %}">
<a class="facebook" title="Share on Facebook"></a> <a class="facebook" title="Share on Facebook"></a>
<a class="linkedin" title="Share on LinkedIn"></a> <a class="linkedin" title="Share on LinkedIn"></a>
<a class="mastodon" title="Share on Mastodon"></a> <a class="mastodon" title="Share on Mastodon"></a>

View file

@ -1,6 +1,5 @@
from django.template import Library from django.template import Library
from django.utils.encoding import force_str from django.utils.encoding import force_str
from wagtail.models import Page
from wagtail.rich_text import RichText from wagtail.rich_text import RichText
from website.common import utils from website.common import utils
@ -13,11 +12,6 @@ def do_range(stop: int) -> range:
return range(stop) return range(stop)
@register.simple_tag(takes_context=True)
def pagefullurl(context: dict, page: Page) -> str:
return page.get_full_url(context["request"])
@register.filter() @register.filter()
def extract_text(html: str | RichText) -> str: def extract_text(html: str | RichText) -> str:
return utils.extract_text(force_str(html)) return utils.extract_text(force_str(html))