Render Hook Tests
Render Hook Test Page
This page tests the custom Hugo render hook for link handling. The render hook automatically processes external links and supports bracket-based overrides.
Standard External Links (Auto New Tab)
These links should automatically open in new tabs with nofollow:
- GitHub - Should open in new tab with nofollow
- Google - Should open in new tab with nofollow
- Stack Overflow - Should open in new tab with nofollow
Internal Links (No Special Treatment)
These links should remain unchanged (no target="_blank", no nofollow):
- Home Page - Should not open in new tab
- Tools Directory - Should not open in new tab
- Search Page - Should not open in new tab
Links with Bracket Overrides
Prevent External Link from Opening in New Tab
Example.com - External link that should NOT open in new tab
Force Internal Link to Open in New Tab
About Page - Internal link that SHOULD open in new tab
Control Nofollow Behavior
Partner Website - External link with forced nofollow Trusted Docs - External link with nofollow prevented
Combined Controls
Special External Link - External link that won’t open in new tab and won’t have nofollow
Mixed Protocol Links
- HTTP Link - HTTPS external link
- Protocol Relative Link - Use explicit HTTPS instead of protocol-relative
Edge Cases
- Link with Title - External link with title attribute
- Link with Emphasis - External link with markdown in text
- Bold Link Text - External link with markdown formatting
Expected Behavior Summary
Link Type | Expected Result |
---|---|
External https:// | target="_blank" rel=“nofollow noopener noreferrer” |
External http:// | target="_blank" rel=“nofollow noopener noreferrer” |
Internal /path | No special attributes |
[nt]External | No target="_blank" |
[ot]Internal | target="_blank" |
[nf]Any | Forces nofollow |
[f]External | No nofollow attribute |
Testing Instructions
- Build the site:
hugo server -D
- Open this page in browser
- Right-click each link and inspect element
- Verify attributes match expected behavior
- Test actual link behavior (new tab vs same tab)