Skip to content

feat: add more links to pages - #22

Merged
calebephrem merged 1 commit into
open-devhub:mainfrom
calebephrem:main
Jul 9, 2026
Merged

feat: add more links to pages#22
calebephrem merged 1 commit into
open-devhub:mainfrom
calebephrem:main

Conversation

@calebephrem

Copy link
Copy Markdown
Member

Added more links for references and overlays

@devhub-bot devhub-bot Bot added the feat New feature label Jul 9, 2026
@beetle-ai

beetle-ai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary by Beetle

This PR enhances the DevHub website by adding extensive internal linking throughout the documentation pages and implementing smart link handling. The changes transform static documentation into an interconnected knowledge base, making navigation more intuitive and improving the user experience. Additionally, the PR adds URL hash-based highlighting for rules and introduces new redirect configurations for GitHub repositories and discussions.

📁 File Changes Summary (Consolidated across all commits):

File Status Changes Description
content/pages.ts Modified +78/-78 Converted 156 plain text references into markdown-style internal links across all documentation pages. Added links to Discord, GitHub org, external tools (Prettier, ESLint, TypeScript), and cross-references between pages (e.g., rules, bots, moderation guide). Improved navigation flow throughout the entire documentation.
app/pages/[slug]/PageClient.tsx Modified +9/-1 Enhanced link rendering logic to intelligently determine when links should open in new tabs. External HTTPS links and redirect sources now open in new tabs, while internal links open in the same tab for seamless navigation.
components/LinkPreviewCard.tsx Modified +4/-2 Added optional newTab prop (defaults to true) to control link target behavior. Updated both the anchor tag and preview card link to respect this setting, enabling context-aware link behavior.
app/rules/page.tsx Modified +20/-5 Implemented URL hash-based rule highlighting using React state and useEffect. Rules can now be directly linked via hash (e.g., #06) and will display with enhanced border styling. Changed rule titles from <h2> to <a> tags to make them clickable anchors.
lib/redirects.config.ts Modified +11/-0 Added two new redirect configurations: /repos and /repositories redirect to the GitHub org repositories page, and /discussions redirects to GitHub org discussions. These provide convenient shorthand URLs for community resources.

Total Changes: 5 files changed, +122 additions, -86 deletions

🗺️ Walkthrough:

graph TD
A["User visits documentation page"] --> B["PageClient renders content"]
B --> C{"Link type detection"}
C -->|"External HTTPS link"| D["LinkPreviewCard with newTab=true"]
C -->|"Redirect source link"| D
C -->|"Internal page link"| E["LinkPreviewCard with newTab=false"]
D --> F["Opens in new tab"]
E --> G["Opens in same tab"]
H["User visits /rules#06"] --> I["useEffect detects hash"]
I --> J["setActiveRule state updated"]
J --> K["Rule 06 highlighted with enhanced border"]
L["User clicks /repos shorthand"] --> M["redirects.config.ts processes"]
M --> N["Redirects to GitHub org repositories"]
style D fill:#4f46e5,stroke:#6366f1,color:#fff
style E fill:#10b981,stroke:#34d399,color:#fff
style K fill:#f59e0b,stroke:#fbbf24,color:#fff
Loading

🎯 Key Changes:

  • Comprehensive Internal Linking: Transformed 156 static text references into functional markdown links across all documentation pages, creating an interconnected knowledge base
  • Smart Link Behavior: Implemented intelligent link target detection that opens external and redirect links in new tabs while keeping internal navigation seamless
  • Rule Deep Linking: Added URL hash-based highlighting for rules page, allowing direct linking to specific rules with visual feedback (enhanced border styling)
  • Improved Navigation: Added shorthand redirects (/repos, /repositories, /discussions) for quick access to GitHub resources
  • Enhanced User Experience: Links now provide context-aware behavior with preview cards that respect whether users should stay on the site or navigate externally

📊 Impact Assessment:

  • Security: ✅ No security concerns. All external links maintain rel="noopener noreferrer" attributes. The redirect configuration is static and doesn't introduce dynamic vulnerabilities.
  • Performance: ✅ Minimal impact. The useEffect hook for hash detection runs once on mount. Link preview cards are already implemented, so no additional rendering overhead. The redirect configuration is processed server-side with negligible performance cost.
  • Maintainability: ✅ Significantly improved. The extensive internal linking creates a self-documenting structure where related concepts are explicitly connected. The newTab prop makes link behavior explicit and configurable. The hash-based highlighting uses standard React patterns that are easy to understand and modify.
  • Testing: ⚠️ Recommendation: While the changes are straightforward, consider adding tests for:
  • Link target behavior (internal vs external detection)
  • Hash-based rule highlighting functionality
  • Redirect configuration validation
  • Link preview card behavior with newTab prop variations
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

Follow us: Beetle · X · LinkedIn

@open-devhub open-devhub deleted a comment from vercel Bot Jul 9, 2026
href={linkMatch[2]}
newTab={
linkMatch[2].startsWith("https") ||
redirects[0].sources.includes(linkMatch[2])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded array index redirects[0] will cause a runtime error if the redirects array is empty. This is a critical bug that will crash the page rendering.

Confidence: 5/5

Suggested Fix
Suggested change
redirects[0].sources.includes(linkMatch[2])
redirects[0]?.sources.includes(linkMatch[2])

Use optional chaining (?.) to safely access the first redirect's sources, or better yet, check if redirects array has elements before accessing. If redirects is empty, this will return undefined which is falsy, preventing the crash.
Alternatively, consider flattening all sources from all redirects:

redirects.some(redirect => redirect.sources.includes(linkMatch[2]))
Prompt for AI

Copy this prompt to your AI IDE to fix this issue locally:

In app/pages/[slug]/PageClient.tsx around line 64, there's a hardcoded array access
redirects[0].sources.includes(linkMatch[2]) that will throw a runtime error if the
redirects array is empty; replace it with redirects[0]?.sources.includes(linkMatch[2])
using optional chaining, or better yet, use redirects.some(redirect =>
redirect.sources.includes(linkMatch[2])) to check all redirect sources instead of
just the first one.

@devhub-bot

devhub-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

Note

Linting checks passed successfully 🎉

All formatting and code quality checks are clean.

You're good to merge 🚀

@calebephrem
calebephrem merged commit 6e57249 into open-devhub:main Jul 9, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant