Adds tracking of broken external links to the SilverStripe CMS
The external links module is a task and ModelAdmin to track and to report on broken external links.
Note: For a SilverStripe 3.x compatible version, please use the 1.x release line.
composer require silverstripe/externallinks
/dev/buildin your browser to rebuild the database.
A new report is added called 'External Broken links report'. When viewing this report, a user may press
the "Create new report" button which will trigger an ajax request to initiate a report run.
In this initial ajax request this module will do one of two things, depending on which modules are included:
In either case, the background task will loop over every page in the system, inspecting all external urls and
checking the status code returned by requesting each one. If a URL returns a response code that is considered
"broken" (defined as < 200 or > 302) then the
ss-broken css class will be assigned to that url, and
a line item will be added to the report. If a previously broken link has been corrected or fixed, then
this class is removed.
In the actual report generated the user can click on any broken link item to either view the link in their browser,
or edit the containing page in the CMS.
While a report is running the current status of this report will be displayed on the report details page, along
with the status. The user may leave this page and return to it later to view the ongoing status of this report.
Any subsequent report may not be generated until a prior report has completed.
Run the following task http://path.to.silverstripe/dev/tasks/CheckExternalLinksTask to check your site for external
If you have the queuedjobs module installed you can set the task to be run every so often.
If you want to ignore or whitelist certain HTTP codes this can be setup via
ignore_codes in the config.yml
SilverStripe\ExternalLinks\Tasks\CheckExternalLinksTask: ignore_codes: - 401 - 403 - 501
When upgrading from 1.x to 2.x (SilverStripe 3.x to 4.x) you will need to be aware of the following API changes:
You may want to follow a redirected URL a example of this would be redirecting from http to https
can give you a false poitive as the http code of 301 will be returned which will be classed
as a working link.
To allow redirects to be followed setup the following config in your config.yml
# Follow 301 redirects SilverStripe\ExternalLinks\Tasks\CurlLinkChecker: follow_location: 1
By default the task will attempt to cache any results the cache can be bypassed with the
following config in config.yml.
# Bypass SS_Cache SilverStripe\ExternalLinks\Tasks\CurlLinkChecker:: bypass_cache: 1
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem