MainTemplate.vala 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Astralis;
  2. using Spry;
  3. using Inversion;
  4. /**
  5. * MainTemplate - The base template for documentation pages
  6. *
  7. * Provides a clean, minimal HTML structure for documentation:
  8. * - HTML5 document structure
  9. * - NavSidebarComponent for navigation
  10. * - docs.css stylesheet for documentation styling
  11. * - htmx.js and htmx-sse.js for interactive components
  12. * - Template outlet for page content
  13. */
  14. public class MainTemplate : PageTemplate {
  15. private NavSidebarComponent nav;
  16. public override string markup { get {
  17. return """
  18. <!DOCTYPE html>
  19. <html lang="en">
  20. <head>
  21. <meta charset="utf-8">
  22. <meta name="viewport" content="width=device-width, initial-scale=1">
  23. <title>Spry Documentation</title>
  24. <link rel="stylesheet" spry-res="docs.css">
  25. </head>
  26. <body>
  27. <div class="page-container">
  28. <spry-component name="NavSidebarComponent" sid="nav"/>
  29. <main class="main-content">
  30. <spry-template-outlet/>
  31. </main>
  32. </div>
  33. <script spry-res="htmx.js"></script>
  34. <script spry-res="htmx-sse.js"></script>
  35. </body>
  36. </html>
  37. """;
  38. }}
  39. public override async void prepare() throws Error {
  40. // Get the nav component - it will use its default current_path
  41. // Pages that need to set a specific current path should do so in their own prepare()
  42. nav = get_component_child<NavSidebarComponent>("nav");
  43. }
  44. }