index_template.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. function baseline_index_start($index_type, $arg) {
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="<?php echo(SITE_LANGUAGE);?>">
  6. <head>
  7. <meta charset="utf-8">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <title><?php echo(PUBLICATION_NAME)?> Index - <?php echo(SITE_NAME);?></title>
  10. <link rel="stylesheet" href="<?php echo(SITE_URL);?>/themes/baseline/baseline.css">
  11. <link rel="alternate" type="application/rss+xml" title="<?php echo(SITE_NAME);?> RSS Feed" href="<?php echo(SITE_URL);?>/feed.rss" />
  12. <style type="text/css">
  13. section img {
  14. filter: saturate(0.4);
  15. transition: filter 0.2s;
  16. }
  17. section:hover img {
  18. filter: saturate(1);
  19. }
  20. section a img {
  21. margin: -8px -18px 8px -18px;
  22. max-width: calc(100% + 36px);
  23. }
  24. <?php baseline_banner_css() ?>
  25. </style>
  26. </head>
  27. <body>
  28. <header role="banner">
  29. <h1><a style="color: var(--text-color); text-decoration: none;" href="<?php echo(SITE_URL);?>"><?php echo(SITE_NAME);?></a></h1>
  30. <?php baseline_navigation(); ?>
  31. </header>
  32. <?php if(USE_PPIX) { ?>
  33. <section class="border-primary" style="padding: 2rem;">
  34. <?php
  35. if($index_type == INDEX_TYPE_MAIN) {
  36. ?>
  37. <form action="./" >
  38. <label for="q"><span class="icon">🔎</span>Search this site:</label><br>
  39. <input style="width: 100%;" type="text" id="q" name="q" placeholder="Search...">
  40. </form>
  41. <?php
  42. if(count($arg) > 0) { ?>
  43. <details>
  44. <summary>Browse by tags</summary>
  45. <ul class="compressed" style="margin-top: 5px;">
  46. <?php
  47. foreach ($arg as $tag) {
  48. ?>
  49. <li><a href="?tag=<?php echo(urlencode($tag));?>"><?php echo(htmlentities($tag));?></a></li>
  50. <?php
  51. }
  52. ?>
  53. </ul>
  54. </details>
  55. <?php }
  56. }
  57. if($index_type == INDEX_TYPE_TAG) {
  58. ?>
  59. <label><span class="icon">🏷️</span>Tagged with <em><?php echo(htmlentities($arg));?></em></label>
  60. <?php
  61. }
  62. if($index_type == INDEX_TYPE_SEARCH) {
  63. ?>
  64. <form action="./">
  65. <label for="q"><span class="icon">🔎</span>Search query:</label><br>
  66. <input style="width: 100%;" type="text" id="q" name="q" value="<?php echo(htmlentities($arg));?>">
  67. </form>
  68. <?php
  69. }
  70. ?>
  71. </section>
  72. <?php
  73. }
  74. }
  75. function baseline_index_no_content($index_type, $arg) {
  76. if($index_type == INDEX_TYPE_SEARCH) {
  77. echo('<section class="border-primary background-secondary" style="padding: 2rem;"><label><span class="icon">ℹ️</span>Nothing found for search query &quot;' . htmlentities($arg) . "&quot.</label></section>");
  78. }
  79. if($index_type == INDEX_TYPE_MAIN) {
  80. echo('<section class="border-primary background-secondary" style="padding: 2rem;"><label><span class="icon">ℹ️</span>There doesn\'t seem to be anything here yet. Be sure to check back soon!</label></section>');
  81. }
  82. }
  83. function baseline_index_listing($ppub, $url) {
  84. ?>
  85. <section>
  86. <a href="<?php echo($url);?>">
  87. <?php
  88. if($ppub->metadata["poster"] != null) {
  89. echo("<img src=\"" . $url . "/" . $ppub->metadata["poster"] . "\" alt='' />");
  90. }
  91. ?>
  92. <h3><?php echo(htmlentities($ppub->metadata["title"]));?></h3></a>
  93. <p><?php echo(htmlentities($ppub->metadata["description"]));?></p>
  94. <ul class="compressed">
  95. <?php
  96. if(USE_PPIX) {
  97. foreach(explode(" ", $ppub->metadata["tags"]) as $tag) {
  98. ?>
  99. <li><a href="<?php echo(SITE_URL);?>/?tag=<?php echo(urlencode($tag));?>"><?php echo(htmlentities($tag));?></a></li>
  100. <?php
  101. }
  102. }
  103. ?>
  104. </ul>
  105. </section>
  106. <?php
  107. }
  108. function baseline_index_end() {
  109. ?>
  110. <footer>
  111. <section class="subtle">
  112. <p class="tight"><strong><?php echo($_SERVER['SERVER_NAME'])?></strong>
  113. <br/><small>Site powered by <a href="https://git.sr.ht/~tilo15/php-ppub/" target="_blank">php-ppub</a> and <a href="https://parsedown.org" target="_blank">Parsedown</a>.</p>
  114. </section>
  115. </footer>
  116. </body>
  117. </html>
  118. <?php
  119. }
  120. ?>