Wagtail external links report
This package adds a report to your wagtail app that lists all external urls you have used on your page. This is useful for moderators to keep track of other websites you are referring to.
Features
- Report View: Adds a report in your wagtail admin that lists all external urls you have used on your page.
- Customizable: You can include or exclude specific page fields and block values with custom handlers.
Installation
You can install the library with the following command:
pip install wagtail-external-links-report
Add the app in your settings/base.py. Optionally define your custom report-view class:
INSTALLED_APPS = [
...
"wagtail_external_links_report",
...
]
...
EXTERNAL_LINKS_REPORT_CLASS = "home.views.CustomExternalLinksReportView"
By default, this app extracts all external urls (by a-tag) that are used in the body field of a page.
It doesn't matter which type the body field is of (can be plain-text, RichText or a StreamField).
When your field is a StreamField, the app will automatically look up all subblocks and subfields for a-tags with external urls.
You can add additional fields for look up. Moreover, you can add your own handlers for extracting urls from custom blocks.
To do this, you need to create a custom class that extends ExternalLinksReportView
and refer to this class in your settings/base.py with EXTERNAL_LINKS_REPORT_CLASS.
# home/views.py
from wagtail_external_links_report.utils import LinkExtractor
from wagtail_external_links_report.views import ExternalLinksReportView
from home.blocks import Button
class CustomExternalLinksReportView(ExternalLinksReportView):
page_title = "used URLS" # you can customize the view name in you wagtail admin too
def get_extractor(self):
return LinkExtractor(
allowed_fields=["title", "body", "footer"], # use your custom fields
custom_handlers={
Button: self.extract_from_button
}
)
def extract_from_button(self, value):
"""Example handler for a custom Button block."""
if value["button_page"] is None and value["button_url"]:
return [{
"text": value["button_text"],
"url": value["button_url"],
}]
return []
In the above example, a custom handler is registered for a custom Block type Button.
This example Button-block can either point to an internal page or to an external page.
With the custom handler you can lookup block-values without searching for a-tags and also exclude specific block-fields.
class Button(blocks.StructBlock):
""" A simple button which can either be an internal page or an external url """
button_text = blocks.CharBlock(required=True, default="more", max_length=40, label="Text")
button_page = blocks.PageChooserBlock(required=False, label="internal page")
button_url = blocks.URLBlock(required=False, label="external URL")
class Meta:
template = "layouts/button.html"
icon = "link"
label = "Button"
Metadata
Release files for wagtail-external-links-report 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wagtail_external_links_report-0.1.1.tar.gz | 329.0 kB | Without provenance | Details for wagtail_external_links_report-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wagtail_external_links_report-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for wagtail_external_links_report-0.1.1-py3-none-any.whl |
Total release size: 336.7 kB
Release files / wagtail_external_links_report-0.1.1.tar.gz
| Download URL | wagtail_external_links_report-0.1.1.tar.gz |
|---|---|
| Size | 329.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f30de060940ac73ead0badba78b3d4543ffab476b03e46c3c873a5c93cbe0be9
|
|
BLAKE2b-256 checksum How to use checksums |
147e2cddaba1585d72a64c4dac3406b5c687e7843a66e4fa9d957af01fa37268
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / wagtail_external_links_report-0.1.1-py3-none-any.whl
| Download URL | wagtail_external_links_report-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09adc043e3e169440e81929693791c0a74488ffc5f4d46f5dde6f1e9c6988dc9
|
|
BLAKE2b-256 checksum How to use checksums |
eb5fd27e385e3e5d146384550821f0061394a55be4ea984f74dfeb3810b8ea94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for wagtail-external-links-report 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.