A tool for checking and cleaning dead links in Markdown files for SSGs
Project description
Link Sweep
Link Sweep is a tool for checking and cleaning dead links specifically within Markdown files for use with static site generators like Zola, Hugo, and Jekyll. Dead links have a negative impact on SEO, security and user experience. This tool was inspired by DeadFinder and designed to be more lightweight, tailored to my specific needs.
This tool is vastly more limited in scope, being designed specifically for recursively targeting markdown files within a given directory. For broader use cases, I recommend DeadFinder
Installation
From PyPI (Recommended)
pip install link-sweep
From Source
git clone https://github.com/yourusername/link-sweep.git
cd link-sweep
pip install -e .
Usage
# Check links in your content directory
link-sweep check-links content/
# Check with verbose output
link-sweep check-links --verbose content/
# Check and automatically remove dead links (no back-up)
link-sweep check-links --remove-dead content/
When using --remove-dead, dead links like [Example](https://dead-link.com) become just Example.
GitHub Actions Integration
This script was designed with the intention of running as part of GitHub Actions, however, it can be run manually. A generic workflow might look something like this:
name: Weekly Link Cleanup
on:
schedule:
- cron: '0 6 * * 1' # Monday 6 AM
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fix dead links
run: link-sweep check-links --remove-dead content/
- name: Create PR if changes
uses: peter-evans/create-pull-request@v5
with:
commit-message: "fix: automated dead link cleanup"
title: "🔧 Weekly dead link cleanup"
The above runs weekly to create a pull request if there are any changes captured within the runner's local files.
License
MIT License - see LICENSE file for details.
Changelog
v0.1.1
- Basic link checking functionality
- Dead link removal option
- CLI interface with Click
- Concurrency for improved perforamance
- Link timeouts
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file link_sweep-0.1.1.tar.gz.
File metadata
- Download URL: link_sweep-0.1.1.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0956c6d5277c47a4214196abd3b0a65c23bb34234586cb28dfab3db8420465e
|
|
| MD5 |
8e87ab0c9dee09cfabebf0b52ca6fbef
|
|
| BLAKE2b-256 |
557672b5806b351ecef84f62d91074945488878a87a8dd9139db6b3a0347a29b
|
File details
Details for the file link_sweep-0.1.1-py3-none-any.whl.
File metadata
- Download URL: link_sweep-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbe4d23059e9a4964efc633a36032abb1781f0eee1d59db0e591c70006870c02
|
|
| MD5 |
3c8a30c663bbb2dd3bc34d42a5482422
|
|
| BLAKE2b-256 |
1500683ff0e04d1f0e8aeffcbcf552f74f374d0313ec161d8611ee51580a42eb
|