-
Notifications
You must be signed in to change notification settings - Fork 1
fix: restrict header anchor links scope #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ne pages The heading render hook was applying anchor link styling to all pages, causing layout issues on the homepage and service pages. Now anchor links only apply to blog posts, case studies, and standalone root-level pages (like /referrals) where deep-linking is useful. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
✅ Deploy Preview for masterpoint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughModified the Hugo heading render hook to conditionally output anchor links. Anchor links now appear only on blog, case-studies, and root-level pages. Other pages render plain heading text without anchor wrappers, changing from unconditional to guarded rendering logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
layouts/_default/_markup/render-heading.html (1)
7-8: Update the comment to reflect the full scope of anchor link application.The comment states anchor links apply to "blog posts and case studies," but the code also enables them for root-level pages (line 18 checks
eq .Page.Section ""). Align the summary comment with the actual implementation and the more detailed comment on line 17.Apply this diff to clarify the scope:
- Only applies to blog posts and case studies to avoid styling conflicts - on marketing pages (home, services, etc.). + Only applies to blog posts, case studies, and standalone root-level pages + to avoid styling conflicts on marketing pages (home, services, etc.).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
layouts/_default/_markup/render-heading.html(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Redirect rules - masterpoint
- GitHub Check: Header rules - masterpoint
- GitHub Check: Pages changed - masterpoint
🔇 Additional comments (2)
layouts/_default/_markup/render-heading.html (2)
15-20: LGTM. The enable logic correctly restricts anchor links to the target sections.The conditional check properly gates anchor links: blog posts, case studies, and root-level pages. The safe default (false) and OR logic are sound. Note that
eq .Page.Section ""will enable anchors for all root-level pages, not just specific ones—if this needs to be narrower (e.g., only/referrals), you would need to add additional checks on the page path or a front-matter flag.Verify that enabling anchors on all root-level pages (not just specific ones like
/referrals) aligns with your intent.
22-31: Conditional rendering logic is correct and accessible.Both branches properly render headings:
- Anchor-enabled branch preserves semantics, accessibility (aria-label), and styling hooks (classes).
- Plain heading branch retains the
idattribute, allowing external deep-links to still work even without visible anchor link styling.The use of
| safeHTMLfilter is consistent and prevents XSS.

what
why
references
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.