# Quick Start: Critical Improvements This guide shows you the fastest path to production-ready status (85% β 95% in ~2 hours). ## π 30-Minute Priority Fixes ### 1. Browser History & Transitions (5 minutes) **File:** `/Users/txeo/Git/yo/cv/templates/index.html` **Find lines 27-42 (language buttons) and update:** ```html ``` **Changes:** - Added `hx-swap="innerHTML swap:200ms settle:200ms"` (smooth transitions) - Added `hx-push-url="/?lang=XX"` (browser history) --- ### 2. ARIA Attributes (10 minutes) **File:** `/Users/txeo/Git/yo/cv/templates/index.html` **Update the action bar section (lines 24-57):** ```html
``` **Update CV content container (lines 60-64):** ```html` tag (after footer):** ```html
``` **File:** `/Users/txeo/Git/yo/cv/static/css/main.css` **Add at the end of the file:** ```css /* Error Toast */ .error-toast { position: fixed; bottom: 2rem; right: 2rem; background: #fee2e2; color: #dc2626; padding: 1rem 1.5rem; border-radius: 8px; border-left: 4px solid #dc2626; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 1rem; max-width: 400px; z-index: 1000; animation: slideIn 0.2s ease-out; } @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } } .error-toast button { background: none; border: none; font-size: 1.5rem; color: #dc2626; cursor: pointer; padding: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; transition: opacity 0.2s; } .error-toast button:hover { opacity: 0.7; } /* Smooth transitions */ .cv-paper { transition: opacity 200ms; } .cv-paper.htmx-swapping { opacity: 0; } ``` --- ### 4. HTMX Configuration (5 minutes) **File:** `/Users/txeo/Git/yo/cv/templates/index.html` **Add in `
` section after meta viewport:** ```html ``` --- ## β±οΈ 1-Hour Enhancement: SEO & Meta Tags **File:** `/Users/txeo/Git/yo/cv/templates/index.html` **Replace entire `
` section:** ```html
``` --- ## π 2-Hour Enhancement: Security Headers **Create file:** `/Users/txeo/Git/yo/cv/middleware/security.go` ```go package middleware import ( "net/http" "os" ) // SecurityHeaders adds security headers to all responses func SecurityHeaders(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Prevent clickjacking w.Header().Set("X-Frame-Options", "DENY") w.Header().Set("X-Content-Type-Options", "nosniff") w.Header().Set("X-XSS-Protection", "1; mode=block") // Content Security Policy csp := "default-src 'self'; " + "script-src 'self' 'unsafe-inline' https://unpkg.com; " + "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " + "font-src 'self' https://fonts.gstatic.com; " + "img-src 'self' data:; " + "connect-src 'self'" w.Header().Set("Content-Security-Policy", csp) // Referrer Policy w.Header().Set("Referrer-Policy", "strict-origin-when-cross-origin") // Permissions Policy w.Header().Set("Permissions-Policy", "geolocation=(), microphone=(), camera=()") // HTTPS-only in production if os.Getenv("GO_ENV") == "production" { w.Header().Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains") } next.ServeHTTP(w, r) }) } // CORS allows cross-origin requests (if needed) func CORS(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { origin := os.Getenv("ALLOWED_ORIGIN") if origin == "" { origin = "*" // Development only } w.Header().Set("Access-Control-Allow-Origin", origin) w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") w.Header().Set("Access-Control-Allow-Headers", "Content-Type") if r.Method == "OPTIONS" { w.WriteHeader(http.StatusOK) return } next.ServeHTTP(w, r) }) } ``` **Update file:** `/Users/txeo/Git/yo/cv/main.go` **Add imports:** ```go import ( // ... existing imports "yourproject/middleware" // Update with your module path ) ``` **Update main() function to use middleware:** ```go func main() { // ... existing setup code // Apply middleware http.Handle("/", middleware.SecurityHeaders(http.HandlerFunc(handleHome))) http.Handle("/cv", middleware.SecurityHeaders(http.HandlerFunc(handleCV))) http.Handle("/export/pdf", middleware.SecurityHeaders(http.HandlerFunc(handlePDFExport))) // ... rest of main() } ``` **Or create a middleware chain:** ```go func main() { // ... existing setup code // Create base handler mux := http.NewServeMux() mux.HandleFunc("/", handleHome) mux.HandleFunc("/cv", handleCV) mux.HandleFunc("/export/pdf", handlePDFExport) // Static files mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) // Apply middleware chain handler := middleware.SecurityHeaders( middleware.CORS(mux), ) // ... start server with handler log.Fatal(http.ListenAndServe(":1999", handler)) } ``` --- ## β Testing Your Improvements ### 1. Test Browser History ```bash # Start server go run main.go # Open browser, click language buttons # Press browser back button - should work! ``` ### 2. Test Error Handling ```bash # Stop the server # In browser, click language button # Should see error toast! ``` ### 3. Test Accessibility ```bash # Use keyboard only: # Tab to language buttons # Press Enter to activate # Tab to export button # Press Enter to print ``` ### 4. Test Security Headers ```bash curl -I http://localhost:1999/ # Should see security headers in response ``` --- ## π Before vs After ### Before (Current) - β No browser history on language change - β No error handling - β Limited accessibility - β οΈ Missing SEO meta tags - β οΈ No security headers - β Excellent performance ### After (30 minutes) - β Browser history works - β Error handling with toast - β ARIA attributes for accessibility - β Smooth transitions - β HTMX timeout configured - β Still excellent performance ### After (2 hours) - β All of the above PLUS: - β Complete SEO meta tags - β Structured data (JSON-LD) - β Security headers - β SRI for external scripts - β Production-ready! --- ## π― Next Steps 1. **Apply 30-minute fixes** β Start here! 2. **Test in browser** 3. **Apply 1-hour SEO enhancements** 4. **Apply 2-hour security enhancements** 5. **Run Lighthouse audit** 6. **Deploy to production!** --- ## π‘ Pro Tips 1. **Backup first:** ```bash cp templates/index.html templates/index.html.backup cp static/css/main.css static/css/main.css.backup ``` 2. **Test incrementally:** - Apply one fix at a time - Test in browser - Commit to git - Move to next fix 3. **Use the enhanced templates:** ```bash # I've already created fully enhanced versions: mv templates/index-improved.html templates/index.html mv static/css/main-enhanced.css static/css/main.css ``` 4. **Validate with tools:** - Lighthouse: `lighthouse http://localhost:1999` - WAVE: Install browser extension - axe DevTools: Install browser extension --- ## π Ready to Go! These quick fixes will take you from **85% β 95% production-ready** in just 30 minutes! For the complete guide, see: `HTMX-PRODUCTION-RECOMMENDATIONS.md`