Skip to content

Commit cdc3971

Browse files
committed
fix: Add dedicated 404.html creation step for GitHub Pages
1 parent 2d42fc8 commit cdc3971

File tree

1 file changed

+115
-62
lines changed

1 file changed

+115
-62
lines changed

.github/workflows/docs.yml

Lines changed: 115 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -412,68 +412,121 @@ jobs:
412412
</html>
413413
EOF
414414
415-
# Create a robots.txt for search engines
416-
cat > target/doc/robots.txt << 'EOF'
417-
User-agent: *
418-
Allow: /
419-
420-
Sitemap: https://rustsandbox.github.io/MCP-Development-with-Rust/sitemap.html
421-
EOF
422-
423-
# Create a custom 404 page
424-
cat > target/doc/404.html << 'EOF'
425-
<!DOCTYPE html>
426-
<html lang="en">
427-
<head>
428-
<meta charset="UTF-8">
429-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
430-
<title>Page Not Found - MCP Rust Examples</title>
431-
<style>
432-
body {
433-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
434-
text-align: center;
435-
padding: 50px;
436-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
437-
color: white;
438-
min-height: 100vh;
439-
margin: 0;
440-
display: flex;
441-
flex-direction: column;
442-
justify-content: center;
443-
align-items: center;
444-
}
445-
.container { background: rgba(255,255,255,0.1); padding: 40px; border-radius: 12px; backdrop-filter: blur(10px); }
446-
h1 { font-size: 4rem; margin-bottom: 20px; }
447-
p { font-size: 1.2rem; margin-bottom: 30px; }
448-
.btn {
449-
display: inline-block;
450-
padding: 12px 24px;
451-
background: rgba(255,255,255,0.2);
452-
color: white;
453-
text-decoration: none;
454-
border-radius: 6px;
455-
transition: background 0.3s ease;
456-
border: 2px solid white;
457-
}
458-
.btn:hover { background: rgba(255,255,255,0.3); }
459-
</style>
460-
</head>
461-
<body>
462-
<div class="container">
463-
<h1>🦀 404</h1>
464-
<p>Oops! The page you're looking for doesn't exist.</p>
465-
<p>But don't worry, there's plenty of great content to explore!</p>
466-
<a href="/MCP-Development-with-Rust/" class="btn">🏠 Go Home</a>
467-
</div>
468-
</body>
469-
</html>
470-
EOF
471-
472-
# Create a CNAME file for custom domain (if needed)
473-
# Uncomment the line below if you have a custom domain
474-
# echo "your-domain.com" > target/doc/CNAME
475-
476-
echo "✅ Site structure created successfully"
415+
# Create a robots.txt for search engines
416+
cat > target/doc/robots.txt << 'EOF'
417+
User-agent: *
418+
Allow: /
419+
420+
Sitemap: https://rustsandbox.github.io/MCP-Development-with-Rust/sitemap.html
421+
EOF
422+
423+
# Create a custom 404 page
424+
cat > target/doc/404.html << 'EOF'
425+
<!DOCTYPE html>
426+
<html lang="en">
427+
<head>
428+
<meta charset="UTF-8">
429+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
430+
<title>Page Not Found - MCP Rust Examples</title>
431+
<style>
432+
body {
433+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
434+
text-align: center;
435+
padding: 50px;
436+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
437+
color: white;
438+
min-height: 100vh;
439+
margin: 0;
440+
display: flex;
441+
flex-direction: column;
442+
justify-content: center;
443+
align-items: center;
444+
}
445+
.container { background: rgba(255,255,255,0.1); padding: 40px; border-radius: 12px; backdrop-filter: blur(10px); }
446+
h1 { font-size: 4rem; margin-bottom: 20px; }
447+
p { font-size: 1.2rem; margin-bottom: 30px; }
448+
.btn {
449+
display: inline-block;
450+
padding: 12px 24px;
451+
background: rgba(255,255,255,0.2);
452+
color: white;
453+
text-decoration: none;
454+
border-radius: 6px;
455+
transition: background 0.3s ease;
456+
border: 2px solid white;
457+
}
458+
.btn:hover { background: rgba(255,255,255,0.3); }
459+
</style>
460+
</head>
461+
<body>
462+
<div class="container">
463+
<h1>🦀 404</h1>
464+
<p>Oops! The page you're looking for doesn't exist.</p>
465+
<p>But don't worry, there's plenty of great content to explore!</p>
466+
<a href="/MCP-Development-with-Rust/" class="btn">🏠 Go Home</a>
467+
</div>
468+
</body>
469+
</html>
470+
EOF
471+
472+
# Create a CNAME file for custom domain (if needed)
473+
# Uncomment the line below if you have a custom domain
474+
# echo "your-domain.com" > target/doc/CNAME
475+
476+
echo "✅ Site structure created successfully"
477+
478+
# Step 5.7: Ensure 404 page is created (fix for deployment issue)
479+
- name: Create 404 page
480+
run: |
481+
echo "Creating 404.html page..."
482+
cat > target/doc/404.html << 'EOF'
483+
<!DOCTYPE html>
484+
<html lang="en">
485+
<head>
486+
<meta charset="UTF-8">
487+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
488+
<title>Page Not Found - MCP Rust Examples</title>
489+
<style>
490+
body {
491+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
492+
text-align: center;
493+
padding: 50px;
494+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
495+
color: white;
496+
min-height: 100vh;
497+
margin: 0;
498+
display: flex;
499+
flex-direction: column;
500+
justify-content: center;
501+
align-items: center;
502+
}
503+
.container { background: rgba(255,255,255,0.1); padding: 40px; border-radius: 12px; backdrop-filter: blur(10px); }
504+
h1 { font-size: 4rem; margin-bottom: 20px; }
505+
p { font-size: 1.2rem; margin-bottom: 30px; }
506+
.btn {
507+
display: inline-block;
508+
padding: 12px 24px;
509+
background: rgba(255,255,255,0.2);
510+
color: white;
511+
text-decoration: none;
512+
border-radius: 6px;
513+
transition: background 0.3s ease;
514+
border: 2px solid white;
515+
}
516+
.btn:hover { background: rgba(255,255,255,0.3); }
517+
</style>
518+
</head>
519+
<body>
520+
<div class="container">
521+
<h1>🦀 404</h1>
522+
<p>Oops! The page you're looking for doesn't exist.</p>
523+
<p>But don't worry, there's plenty of great content to explore!</p>
524+
<a href="/MCP-Development-with-Rust/" class="btn">🏠 Go Home</a>
525+
</div>
526+
</body>
527+
</html>
528+
EOF
529+
echo "✅ 404.html created successfully"
477530
478531
# Step 6: Verify documentation structure
479532
- name: Verify documentation

0 commit comments

Comments
 (0)