A Quarto extension that automatically checks for broken external links in your documents during rendering.
To install the linkrot Quarto extension, follow these steps:
- Open your terminal.
- Execute the following command:
quarto add coatless-quarto/linkrotThis command will download and install the Quarto extension under the _extensions subdirectory of your Quarto project.
If you are using version control, ensure that you include this directory in your repository.
- Quarto >= 1.7.0
curlcommand-line tool:- Linux/macOS: Usually pre-installed
- Windows: Built-in on Windows 10 (1803+) and Windows 11
- Older Windows: Install curl for Windows or use Git Bash which includes curl
Add the extension to your document's YAML header:
---
title: "My Document"
filters:
- linkrot
---The extension will automatically check all external HTTP/HTTPS links during rendering and report any broken links.
You can configure linkrot's behavior in your document's YAML using the extensions.linkrot key:
---
title: "My Document"
filters:
- linkrot
extensions:
linkrot:
fail-on-error: false # Set to true to fail the build if broken links are found
timeout: 10 # Timeout in seconds for each URL check
user-agent: "Quarto-Linkrot/1.0" # User agent string for requests
cache-results: true # Cache results to avoid checking the same URL multiple times
debug: false # Enable debug logging
output-file: null # Write results to a file (e.g., "linkrot-report.txt")
skip-patterns: # List of regex patterns to skip
- "example\\.com"
- "localhost"
---- If set to
true, the build will fail if any broken links are detected. Useful for CI/CD pipelines.
- Maximum time in seconds to wait for each URL to respond.
- User agent string sent with HTTP requests.
- Cache URL check results to avoid repeatedly checking the same URL in a document.
- Enable debug logging to see detailed information about what linkrot is doing.
- Path to a file where results will be written. If not specified, results are only shown in the console.
- List of regex patterns. URLs matching any pattern will be skipped (not checked).
When the extension runs, you'll see output like this in the console:
=== Linkrot Results ===
Total external links checked: 15
Broken links found: 2
Broken links:
1. [Example Link] https://example.com/broken-page (Status: 404)
2. [Another Link] https://nonexistent-site-xyz123.com (Status: timeout/error)
You can also specify an output file to save the results.