docs: customize the 404 not found page#333
Conversation
Documentation build overview
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #333 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 16
Lines 580 580
=========================================
Hits 580 580 Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Code Review
This pull request introduces a custom 404 error page with a statistical theme and updates the configuration to enable template overrides. The review feedback suggests using theme-specific CSS variables for font consistency, utilizing the MkDocs url filter for better environment compatibility in links, and avoiding the use of !important in CSS to ensure better maintainability.
| </div> | ||
|
|
||
| <a | ||
| href="{{ config.site_url | default(base_url ~ '/../') }}" |
There was a problem hiding this comment.
Using config.site_url for the home link can lead to issues in local development or staging environments, as it typically points to the production URL. It is recommended to use the MkDocs url filter, which correctly handles relative paths across different deployment environments and ensures the link works correctly during local preview (mkdocs serve).
href="{{ 'index.html' | url }}"
| [data-md-component="content"] { | ||
| margin-left: 0 !important; | ||
| width: 100% !important; | ||
| } | ||
| .md-sidebar--primary, | ||
| .md-sidebar--secondary { | ||
| display: none !important; | ||
| } |
There was a problem hiding this comment.
The use of !important to override layout styles (like margin-left and width) is generally discouraged as it makes the CSS harder to maintain and can cause issues with future theme updates. Since the sidebars are already emptied via Jinja2 blocks (left_sidebar and right_sidebar), the layout should naturally adjust. Consider using more specific selectors or checking if the theme's default layout can achieve the same centering without forced overrides.
No description provided.