Skip to content

Implement static header navigation for improved SEO indexing#37

Merged
uberdragon merged 1 commit intomainfrom
feature/static-header-navigation
Mar 21, 2026
Merged

Implement static header navigation for improved SEO indexing#37
uberdragon merged 1 commit intomainfrom
feature/static-header-navigation

Conversation

@uberdragon
Copy link
Copy Markdown
Owner

Summary

This PR moves the header and navigation from JavaScript-rendered to static HTML, addressing the critical SEO indexing issue where search engines couldn't see the navigation structure on initial crawl.

Problem

The site was being crawled by Google but not indexed. The root cause was JavaScript-dependent navigation - search engines initially saw an empty <div id="header-container"></div> instead of the actual header and navigation.

Solution

Implemented a build-time header injection system that:

  • Maintains a single source of truth in header-template.html
  • Injects the header HTML during GitHub Actions deployment
  • Keeps JavaScript for interactive enhancements only (active states, etc.)

Changes

  • Created docs/header-template.html: Single source of truth for header/navigation
  • Updated .github/workflows/deploy.yml: Extended deployment to inject header template
  • Refactored docs/js/header.js: Changed from generating HTML to enhancing static HTML

Benefits

  • 🎯 Improved SEO: Search engines see complete page structure immediately
  • 🎯 No layout shift: Header is present from initial page load
  • 🎯 Single source of truth: Edit only one file for navigation changes
  • 🎯 Better Core Web Vitals: No CLS from delayed header rendering
  • 🎯 Backward compatible: JavaScript enhancement still works

How It Works

  1. Source HTML files keep <div id="header-container"></div> placeholder
  2. During deployment, GitHub Actions reads header-template.html
  3. Template is injected after the placeholder div in each HTML file
  4. Deployed pages have full static HTML visible to search engines
  5. JavaScript enhances the static header with active states

Testing

✅ Tested header injection logic locally - successfully injects template
✅ All 5 HTML files have the header-container placeholder
✅ Deployment workflow validation checks included

To Edit Navigation (After Merge)

Simply edit docs/header-template.html - changes will automatically apply to all pages on next deployment.


🤖 Generated with Claude Code

This change moves the header and navigation from JavaScript-rendered to
static HTML, which significantly improves search engine indexing.

Changes:
- Created docs/header-template.html as single source of truth for header
- Updated deployment workflow to inject header template into all HTML files
- Refactored header.js to only handle interactive features (active states)
- Header is now visible to search engines without JavaScript execution

Benefits:
- Search engines see complete page structure on initial crawl
- Eliminates two-phase indexing delay for JavaScript content
- Improves Core Web Vitals (no layout shift from delayed header load)
- Better accessibility for users with JavaScript disabled
- Maintains single source of truth via build-time injection

The header template is injected during GitHub Actions deployment,
similar to the existing GTM ID replacement pattern.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@uberdragon uberdragon merged commit 0df8191 into main Mar 21, 2026
@uberdragon uberdragon deleted the feature/static-header-navigation branch March 21, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant