feat: implemented code to use with jinja
This commit is contained in:
		| @@ -1,9 +1,9 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="{article_language_code}"> | ||||
| <html> | ||||
|   <head> | ||||
|     <meta charset="utf-8" /> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||||
|     <title>{article_language_flag} {article_title}</title> | ||||
|     <title>{article_title}</title> | ||||
|     <link rel="stylesheet" href="/static/bulma.min.css" /> | ||||
|   </head> | ||||
|   <body> | ||||
| @@ -14,21 +14,27 @@ | ||||
|       aria-label="main navigation" | ||||
|     > | ||||
|       <div class="navbar-brand"> | ||||
|         <a class="navbar-item" href="{article_overview_url}"> | ||||
|           <strong>{article_language_flag} {article_title}</strong> | ||||
|           <time datetime="{article_datetime_iso}">{article_datetime}</time> | ||||
|         <a class="navbar-item" href="#"> | ||||
|           <strong>Static Translated Site Generator</strong> | ||||
|         </a> | ||||
|       </div> | ||||
|     </nav> | ||||
|  | ||||
|     <!-- Main Content --> | ||||
|     <section class="section"> | ||||
|       <div class="content"> | ||||
|         {article_content} | ||||
|       <div class="container content"> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           <h1>Translations</h1> | ||||
|         </div> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           {article_translation_cards} | ||||
|         </div> | ||||
|       </div> | ||||
|  | ||||
|         <h1>Further Reading</h1> | ||||
|  | ||||
|         <div class="row"> | ||||
|       <div class="container content"> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           <h1>Child Articles</h1> | ||||
|         </div> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           {article_children_cards} | ||||
|         </div> | ||||
|       </div> | ||||
| @@ -41,4 +47,23 @@ | ||||
|       </div> | ||||
|     </footer> | ||||
|   </body> | ||||
|  | ||||
|   <script> | ||||
|     document.addEventListener("DOMContentLoaded", function () { | ||||
|         const userLang = navigator.language || navigator.userLanguage; | ||||
|  | ||||
|         // Normalize and check if the language is not English or German | ||||
|         if (!["en", "de", "de-DE"].includes(userLang)) { | ||||
|             // Try to find a matching card by language attribute | ||||
|             const cardToMove = | ||||
|                 document.querySelector(`.card[lang^="${userLang.replace("_", "-").toLowerCase()}"]`) || | ||||
|                 document.querySelector(`.card[lang^="${userLang.split("-")[0]}"]`); | ||||
|  | ||||
|             if (cardToMove) { | ||||
|                 const container = cardToMove.parentNode; | ||||
|                 container.insertBefore(cardToMove, container.firstChild); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|   </script> | ||||
| </html> | ||||
|   | ||||
							
								
								
									
										44
									
								
								src/templates/article_translation.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/templates/article_translation.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="{article_language_code}"> | ||||
|   <head> | ||||
|     <meta charset="utf-8" /> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||||
|     <title>{article_language_flag} {article_title}</title> | ||||
|     <link rel="stylesheet" href="/static/bulma.min.css" /> | ||||
|   </head> | ||||
|   <body> | ||||
|     <!-- Header (Navbar) --> | ||||
|     <nav | ||||
|       class="navbar is-primary" | ||||
|       role="navigation" | ||||
|       aria-label="main navigation" | ||||
|     > | ||||
|       <div class="navbar-brand"> | ||||
|         <a class="navbar-item" href="{article_overview_url}"> | ||||
|           <strong>{article_language_flag} {article_title}</strong> | ||||
|           <time datetime="{article_datetime_iso}">{article_datetime}</time> | ||||
|         </a> | ||||
|       </div> | ||||
|     </nav> | ||||
|  | ||||
|     <!-- Main Content --> | ||||
|     <section class="section"> | ||||
|       <div class="content"> | ||||
|         {article_content} | ||||
|  | ||||
|         <h1>Further Reading</h1> | ||||
|  | ||||
|         <div class="row"> | ||||
|           {article_children_cards} | ||||
|         </div> | ||||
|       </div> | ||||
|     </section> | ||||
|  | ||||
|     <!-- Footer --> | ||||
|     <footer class="footer"> | ||||
|       <div class="content has-text-centered"> | ||||
|         <p><strong>STSG</strong> by Hazel. © 2025</p> | ||||
|       </div> | ||||
|     </footer> | ||||
|   </body> | ||||
| </html> | ||||
| @@ -1,69 +0,0 @@ | ||||
| <!DOCTYPE html> | ||||
| <html> | ||||
|   <head> | ||||
|     <meta charset="utf-8" /> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||||
|     <title>{article_title}</title> | ||||
|     <link rel="stylesheet" href="/static/bulma.min.css" /> | ||||
|   </head> | ||||
|   <body> | ||||
|     <!-- Header (Navbar) --> | ||||
|     <nav | ||||
|       class="navbar is-primary" | ||||
|       role="navigation" | ||||
|       aria-label="main navigation" | ||||
|     > | ||||
|       <div class="navbar-brand"> | ||||
|         <a class="navbar-item" href="#"> | ||||
|           <strong>Static Translated Site Generator</strong> | ||||
|         </a> | ||||
|       </div> | ||||
|     </nav> | ||||
|  | ||||
|     <section class="section"> | ||||
|       <div class="container content"> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           <h1>Translations</h1> | ||||
|         </div> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           {article_translation_cards} | ||||
|         </div> | ||||
|       </div> | ||||
|  | ||||
|       <div class="container content"> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           <h1>Child Articles</h1> | ||||
|         </div> | ||||
|         <div class="column is-half is-offset-one-quarter"> | ||||
|           {article_children_cards} | ||||
|         </div> | ||||
|       </div> | ||||
|     </section> | ||||
|  | ||||
|     <!-- Footer --> | ||||
|     <footer class="footer"> | ||||
|       <div class="content has-text-centered"> | ||||
|         <p><strong>STSG</strong> by Hazel. © 2025</p> | ||||
|       </div> | ||||
|     </footer> | ||||
|   </body> | ||||
|  | ||||
|   <script> | ||||
|     document.addEventListener("DOMContentLoaded", function () { | ||||
|         const userLang = navigator.language || navigator.userLanguage; | ||||
|  | ||||
|         // Normalize and check if the language is not English or German | ||||
|         if (!["en", "de", "de-DE"].includes(userLang)) { | ||||
|             // Try to find a matching card by language attribute | ||||
|             const cardToMove = | ||||
|                 document.querySelector(`.card[lang^="${userLang.replace("_", "-").toLowerCase()}"]`) || | ||||
|                 document.querySelector(`.card[lang^="${userLang.split("-")[0]}"]`); | ||||
|  | ||||
|             if (cardToMove) { | ||||
|                 const container = cardToMove.parentNode; | ||||
|                 container.insertBefore(cardToMove, container.firstChild); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|   </script> | ||||
| </html> | ||||
		Reference in New Issue
	
	Block a user