-
-
Notifications
You must be signed in to change notification settings - Fork 258
Add custom 404 copy step to deploy workflow #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
247de1a
fee8071
35c8513
42caa1f
958b832
59520f1
5ec8de2
bb87ea8
71dbad9
cd293cf
908ee4c
0c10384
73d44d6
e8f9c22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,9 +22,16 @@ jobs: | |
| run: | | ||
| bash ci/build_website.sh | ||
|
|
||
|
|
||
| - name: Copy global 404.html | ||
| run: | | ||
| cp DISCOVER/404.html DISCOVER/_build/html/404.html | ||
|
|
||
|
|
||
| - name: Push book HTML to gh-pages | ||
| uses: peaceiris/[email protected] | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./DISCOVER/_build/html | ||
| keep_files: true | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also undo the rename of the file as it is done in #365 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
| <title>404 - Not Found</title> | ||
| <style> | ||
| * { | ||
| box-sizing: border-box; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
| body { | ||
| height: 100vh; | ||
| background: linear-gradient(135deg, black, #e4f0ff); | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| font-family: 'Segoe UI', sans-serif; | ||
| overflow: hidden; | ||
| position: relative; | ||
| } | ||
|
|
||
| .light-blur { | ||
| position: absolute; | ||
| width: 500px; | ||
| height: 500px; | ||
| background: radial-gradient(circle at center, transparent); | ||
| border-radius: 50%; | ||
| filter: blur(80px); | ||
| top: 20%; | ||
| left: 10%; | ||
| animation: drift 10s ease-in-out infinite alternate; | ||
| z-index: 0; | ||
| } | ||
|
|
||
| @keyframes drift { | ||
| 0% { transform: translate(0, 0); } | ||
| 100% { transform: translate(60px, 30px); } | ||
| } | ||
|
|
||
| .glass-card { | ||
| background: rgba(255, 255, 255, 0.25); | ||
| backdrop-filter: blur(12px); | ||
| -webkit-backdrop-filter: blur(12px); | ||
| padding: 2.5rem 3rem; | ||
| border-radius: 20px; | ||
| border: 1px solid rgba(255, 255, 255, 0.3); | ||
| max-width: 500px; | ||
| text-align: center; | ||
| z-index: 1; | ||
| box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); | ||
| } | ||
|
|
||
| h1 { | ||
| font-size: 2.5em; | ||
| color: rgb(52, 51, 51); | ||
| margin-bottom: 0.5rem; | ||
| } | ||
|
|
||
| p { | ||
| font-size: 1.1em; | ||
| color: rgb(52, 51, 51); | ||
| margin-bottom: 1.4rem; | ||
| } | ||
|
|
||
| a { | ||
| display: inline-block; | ||
| margin: 0.4rem; | ||
| padding: 0.6rem 1rem; | ||
| border-radius: 8px; | ||
| text-decoration: none; | ||
| background: #d0bfff; | ||
| color: #1f1f1f; | ||
| font-weight: 600; | ||
| transition: background 0.3s ease; | ||
| } | ||
|
|
||
| a:hover { | ||
| background: #c1aaff; | ||
| } | ||
|
|
||
| select { | ||
| margin-top: 1rem; | ||
| padding: 0.5rem; | ||
| border-radius: 6px; | ||
| border: 1px solid #ccc; | ||
| font-size: 1em; | ||
| background: #fff; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="light-blur"></div> | ||
| <div class="glass-card"> | ||
| <h1 id="title">404 - Page Not Found</h1> | ||
| <p id="message">This page might’ve wandered off or was never here at all.</p> | ||
| <p id="suggestion">Maybe it was deleted, renamed, or never existed in the first place.</p> | ||
| <p><strong id="what-do">What can you do?</strong></p> | ||
| <a href="./intro.html" id="home">⬅️ Back to Home</a> | ||
| <a href="https://github.com/numfocus/DISCOVER-Cookbook/issues" id="report">🐞 Report the Issue</a> | ||
|
|
||
| <div> | ||
| <label for="language-switcher" style="display:block; margin-top:1.5rem; color:#444;">🌐 Switch Language:</label> | ||
| <select id="language-switcher"> | ||
| <option value="en">English</option> | ||
| <option value="es">Español</option> | ||
| </select> | ||
| </div> | ||
|
|
||
| <p id="footer" style="margin-top: 1.2rem;">If you think this is an error, let us know by creating an issue.</p> | ||
| </div> | ||
|
|
||
| <script> | ||
| const translations = { | ||
| en: { | ||
| title: "404 - Page Not Found", | ||
| message: "This page might’ve wandered off or was never here at all.", | ||
| suggestion: "Maybe it was deleted, renamed, or never existed in the first place.", | ||
| whatDo: "What can you do?", | ||
| home: "⬅️ Back to Home", | ||
| report: "🐞 Report the Issue", | ||
| footer: "If you think this is an error, let us know by creating an issue." | ||
| }, | ||
| es: { | ||
| title: "404 - Página no encontrada", | ||
| message: "Esta página se ha perdido o nunca existió.", | ||
| suggestion: "Tal vez fue eliminada, renombrada o nunca existió.", | ||
| whatDo: "¿Qué puedes hacer?", | ||
| home: "⬅️ Volver al inicio", | ||
| report: "🐞 Informar del problema", | ||
| footer: "Si crees que esto es un error, infórmanos creando un issue." | ||
| } | ||
| }; | ||
|
|
||
| function detectLanguage() { | ||
| const pathLang = location.pathname.split("/")[1]; | ||
| const refLang = new URL(document.referrer || "", location.origin).pathname.split("/")[1]; | ||
| const storedLang = localStorage.getItem("preferredLang"); | ||
| return translations[pathLang] | ||
| ? pathLang | ||
| : translations[refLang] | ||
| ? refLang | ||
| : translations[storedLang] | ||
| ? storedLang | ||
| : "en"; | ||
| } | ||
|
|
||
| function applyLanguage(lang) { | ||
| const t = translations[lang] || translations["en"]; | ||
| document.getElementById("title").textContent = t.title; | ||
| document.getElementById("message").textContent = t.message; | ||
| document.getElementById("suggestion").textContent = t.suggestion; | ||
| document.getElementById("what-do").textContent = t.whatDo; | ||
| document.getElementById("home").textContent = t.home; | ||
| document.getElementById("report").textContent = t.report; | ||
| document.getElementById("footer").textContent = t.footer; | ||
| document.getElementById("language-switcher").value = lang; | ||
| localStorage.setItem("preferredLang", lang); | ||
| } | ||
|
|
||
| const initialLang = detectLanguage(); | ||
| applyLanguage(initialLang); | ||
|
|
||
| document.getElementById("language-switcher").addEventListener("change", function () { | ||
| applyLanguage(this.value); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be part of this PR but a different one. Not sure why this file was missing form the toc but it should definitely be added, just in a different PR |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the build website script already does this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove it then