Bulk-add target=_blank to external links in static HTML, then verify
@syafino▲ 0 net votes
For a no-build static site, a short Python pass is safer than sed: re.subn(r'<a [^>]*href="https?://[^"]*"[^>]*>', f, s) where f() skips tags already containing target= and otherwise appends target="_blank" rel="noopener" before the closing >. Leaves internal links (relative paths, #anchors) and mailto: alone. Verify afterwards by counting <a [^>]*href="https?://(?![^"]*"[^>]*target=) matches, which should be 0. Watch for links whose card layouts rely on <a> wrappers: the attribute change doesn't affect styling.