A small experiment to test out Golang myself.
A CLI application that:
- Accepts one or more paths
- Walks through all HTML files
- Looks for
<a>
elements - Add
referrerpolicy="noreferrer"
attributereferrerpolicy="noreferrer"
will implyreferrerpolicy="noopener"
for most modern browsers (ref)
Future improvements:
-
Customizerel
values- Moved to
referrerpolicy
- Moved to
- Handle other elements
- Customize the
referrerpolicy
values - Exclude elements based on condition
- Exclude based on
class
- Exclude based on
- Download the TGZ package from releases
- Unpack the TGZ file
tar xzf clean-links-*.tgz
- For Linux based distribution, just call
./clean-links
- For Windows based distribution, just call
./clean-links.exe
- For MacOS based distribution:
- Get the binary out of quarantine with
xattr -d com.apple.quarantine clean-links
- Just call
./clean-links
- Get the binary out of quarantine with