Skip to main content

Wagtail Link Block

A link block to use as part of other StructBlocks which lets the user choose a link either to a Page, Document, external URL, Email, telephone or anchor within the current page and whether or not they want the link to open in a new window.

It hides the unused fields, making the admin clearer and less cluttered.

Installation

Using pip:

$ pip install wagtail-link-block

Edit your Django project's settings module, and add the application to INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "wagtail_link_block",
    # ...
]

Usage

To use in a block

from wagtail_link_block.blocks import LinkBlock

class MyButton(StructBlock):
    text = CharBlock()
    link = LinkBlock()

    class Meta:
        template = "blocks/my_button_block.html"

And create the template blocks/my_button_block.html:

<a href="{{ self.link.get_url }}" {% if self.link.new_window %}target="_blank" rel="noopener noreferrer"{% endif %}>
    {{ self.text }}
</a>

Metadata

Release files for wagtail-link-block 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-link-block 1.2
File Size Uploaded
wagtail_link_block-1.2.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-link-block 1.2
File Interpreter ABI Platform
wagtail_link_block-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page