Add page-specific 'Edit this page' link to footer #3637
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a page-specific "Edit this page" link to the footer that replaces the "Powered by Mintlify" link. The link dynamically points to the corresponding .mdx file in the GitHub repository.
Example: On
/statsig-warehouse-native/connecting-your-warehouse/athena, the footer shows "Edit this page" linking tohttps://github.com/statsig-io/docs/blob/main/statsig-warehouse-native/connecting-your-warehouse/athena.mdxImplementation: Custom JavaScript file (
edit-page.js) that:Key Review Points
1. URL Mapping Assumptions (Lines 18-23)
The code assumes all page URLs map directly to
.mdxfiles at the same path:Needs testing:
2. Footer Detection & Retry Logic (Lines 26-32)
Implements bounded retry to prevent infinite loops if footer never appears:
Needs verification: Does the footer consistently appear within 10 retries (5 seconds)?
3. MutationObserver Performance (Lines 67-71)
Observes entire document body with
subtree: truewhich could be expensive:Needs monitoring: Performance on slower devices. The 100ms debouncing should help but worth testing.
4. Fallback Logic (Lines 34-57)
Multiple fallback paths for finding/creating the link:
Needs verification: Test against Mintlify's actual footer structure to ensure this works correctly.
Best practice checklist
Human Review Checklist
Please thoroughly test before merging:
Basic Functionality
Page-Specific Links
Client-Side Routing
Edge Cases
Performance
Questions?
Reach out to Brock, Tore, or Logan on Slack!
Link to Devin run: https://app.devin.ai/sessions/fbe45751af4b46af9491a0cf0fc7ec26
Requested by: [email protected] (@xhuang-statsig)