Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 1.5 KB

README.md

File metadata and controls

56 lines (42 loc) · 1.5 KB

Dead Links

This plugin scans for links and checks status code of requested url. For responses such as 403 or 404, the plugin adds a "disabled" class to the anchor, extends anchor with a span label and dumps warning to the logger.

Requirements

BeautifulSoup4, requests

To install them using pip, type: pip install bs4 requests

Installation

Clone repository somewhere (let's assume destination is ./plugins/custom/deadlinks) and edit configuration file:

    PLUGINS_PATH = [
        # [...]
        'plugins/custom'
    ]
    PLUGINS = [
         # [...]
        'deadlinks'
    ]

Settings

To enable dead link checker, set the DEADLINK_VALIDATION option in your Pelican configuration file to True.

Additionally following options might be changed:

    DEADLINK_OPTS = {
        'archive':  True,
        'classes': ['custom-class1', 'disabled'],
        'labels':   True,
        'timeout_duration_ms': 1000,
        'timeout_is_error':    False,
    }

Options:

Name Description Default value
archive True/False. When enabled invalid links will be replaced with proper archive.org entry True
classes List of classes to be add to anchor element Empty list
labels Insert bootstrap's label after the anchor element False
timeout_duration_ms Time in ms after which request is considered as timed out 1000
timeout_is_error True/False. When enabled every time out is considered as dead link False