This Enonic XP application adds a widget to your Enonic XP site. This widget lets you check all your content for broken links, both internal (to other content on same site) and external (URL).
Go into the Enonic XP Application admin tool and install the app from the Enonic Market.
The Link checker app will then be available in the widget panel in the content studio.
Build this app with gradle. In the terminal, from the root of the project, enter ./gradlew build
.
On Windows, just enter gradlew build
in the command line from the project root.
Next, move the JAR file from /build/libs to your $XP_HOME/deploy
directory.
The Link checker app will then be available in the widget panel in the content studio.
If you update package.json, make sure to run ./gradlew npm_install
.
After adding this app you should see a new LinkChecker option in detail panel to the top right in the content studio. Selecting a content and pressing the Start button will start the process. It will check the current content and all its children content for broken links. You can choose to only check the selected content, only the sub-content of that content or both.
NB! The internal data of the content is searched for links, not the corresponding webpage. Check Siteimprove app for a more complete check.
The result is cached, so if the content and its children have not been modified since last check it will return the cached result immediatly.
The checking process can be stopped anytime while checking and return the result found so far. This will however not cache any results.
If you select another content while the checker is running, it will continue in the background. If you go back to the content you started on the widget will try to reestablish connection.
A max of 10 broken links are show in the detail panel. If more are found they are detailed in the downloadable spreadsheet.
After getting a result you can download it as an Excel spreadsheet. This has the form:
displayName | Path | broken link | status |
---|---|---|---|
Contact us | /en/contact-us | http://www.brokenlink.broken | 404 |
https://enonic.com/doesnotexist | 404 | ||
Article B | /en/blog/article-b | http://www.example.crash | 500 |
22c1574a-38f4-4cf444-5fgd9sd | 404 |
Status | Meaning |
---|---|
404 | The site could not be found |
500 | Internal server error at requested site |
526 | Invalid SSL certificate |
Timeout / 408 | The site took too long to respond |
If you are running HTTPS and you are met with failed: Error during WebSocket handshake: Unexpected response code: 200
, add the following code to your conf file in your apache server with mod_rewrite
activated:
<VirtualHost *:443>
...
RewriteEngine on
...
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteCond %{REQUEST_URI} /admin [NC]
RewriteRule /admin/(.*) ws://exp:8080/admin/$1 [P,L]
...
</VirtualHost>
Version | XP version |
---|---|
3.1.0 | >=7.9.0 |
3.0.1 | >=7.9.0 |
3.0.0 | >=7.9.0 |
2.0.1 | >=7.2.0 |
2.0.0 | >=7.2.0 |
1.0.0 | >=6.12.0 |
Not tested for below 6.12.0