https://github.com/developersociety/wagtail-link-block
A LinkBlock for wagtail (allows choice of Page / Document / External URL).
https://github.com/developersociety/wagtail-link-block
Last synced: 5 months ago
JSON representation
A LinkBlock for wagtail (allows choice of Page / Document / External URL).
- Host: GitHub
- URL: https://github.com/developersociety/wagtail-link-block
- Owner: developersociety
- License: bsd-3-clause
- Created: 2020-08-18T13:32:25.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-11-25T16:16:15.000Z (7 months ago)
- Last Synced: 2025-11-28T21:51:34.014Z (7 months ago)
- Language: Python
- Size: 65.4 KB
- Stars: 25
- Watchers: 2
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://pip.pypa.io/):
```console
$ pip install wagtail-link-block
```
Edit your Django project's settings module, and add the application to ``INSTALLED_APPS``:
```python
INSTALLED_APPS = [
# ...
"wagtail_link_block",
# ...
]
```
## Usage
To use in a block
```python
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`:
```html
{{ self.text }}
```