pub / stories

Top News Aggregator
git clone src.jayvii.de/pub/stories.git
Home | Log | Files | Exports | Refs | RSS

index.tt (4544B)


      1 <!-- SPDX-License-Identifier: AGPL-3.0-or-later
      2      SPDX-FileCopyrightText: 2021-2026 JayVii <jayvii[AT]posteo[DOT]de>
      3 -->
      4 
      5 <!DOCTYPE html>
      6 <html>
      7   <head>
      8     <meta charset="utf-8">
      9     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     10     <title>[% feed.title %]</title>
     11     <meta name="description" content="[% feed.description %]">
     12     [% IF feed.author %]
     13     <meta name="author" content="[% feed.author %]">
     14     [% END %]
     15     <link rel="icon" type="image/png" href="assets/favicon.png">
     16     <link rel="icon" type="image/png" sizes="16x16"
     17       href="assets/favicon_16.png"
     18     />
     19     <link rel="icon" type="image/png" sizes="32x32"
     20       href="assets/favicon_32.png"
     21     />
     22     <link rel="icon" type="image/png" sizes="64x64"
     23       href="assets/favicon_64.png"
     24     />
     25     <link rel="icon" type="image/png" sizes="128x128"
     26       href="assets/favicon_128.png"
     27     />
     28     <link rel="apple-touch-icon" href="assets/favicon.png">
     29     <link rel="stylesheet" type="text/css" href="assets/css/simple.min.css">
     30     <link rel="stylesheet" type="text/css" href="assets/css/custom.css">
     31     <link crossorigin="use-credentials" rel="manifest" href="assets/manifest.json">
     32     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     33     <meta name="robots" content="noindex">
     34   </head>
     35 
     36   <body>
     37 
     38     <header>
     39       <nav>
     40         <!-- "Overview" -->
     41         <a href="/">Overview</a>
     42         <!-- Privacy Policy -->
     43         <a href="https://www.jayvii.de/privacy/#newsjayviide" target="_blank">
     44           Privacy
     45         </a>
     46       </nav>
     47       <!-- Feed Title -->
     48       <h1>[% feed.title | html %]</h1>
     49       <p>[% feed.description | html %]</p>
     50     </header>
     51 
     52     <main>
     53 
     54       <?php
     55 
     56         $news = array();
     57         [% FOREACH entry IN feed.entries %]
     58         array_push(
     59           $news,
     60           array(
     61             "title" => "[%entry.title | html %]",
     62             "url" => "[% entry.link | url %]",
     63             "date" => strtotime("[% entry.issued | html %]"),
     64             "content" => "[% IF entry.summary.body %][% entry.summary.body | html %][% ELSE %][% entry.content.body | html %][% END %]"
     65           )
     66         );
     67         [% END %]
     68 
     69         // Sort News item by time stamp and remove duplicate entries
     70         function compare(array $a, array $b) {
     71           return $b["date"] - $a["date"];
     72         }
     73         usort($news, "compare");
     74         $news = array_intersect_key(
     75           $news,
     76           array_unique(
     77             array_map('serialize', $news)
     78           )
     79         );
     80         
     81       ?>
     82 
     83       <!-- Content Entries -->
     84       <?php
     85         $counter = 0;
     86         foreach ($news as $entry) {
     87 
     88           if ($entry["date"] < strtotime("-24 hours")) {
     89             continue;
     90           }
     91           if ($entry["content"] == "" || $entry["content"] == $entry["title"]) {
     92             continue;
     93           }
     94           $counter++;
     95           if ($counter > 20) {
     96             continue;
     97           }
     98 
     99 
    100           $entry["content"] = preg_replace(
    101             '/<[^>]+>/',
    102             '',
    103             html_entity_decode($entry["content"])
    104           );
    105           $entry["domain"] = preg_replace(
    106             '/^http(s)*:\/\/([^\/]+)\/.*$/',
    107             '${2}',
    108             $entry["url"]
    109           );
    110 
    111       ?>
    112       <section>
    113         <!-- Headline -->
    114         <h4 style="margin-bottom:5px;">
    115           <a href="<?php echo $entry["url"]; ?>"
    116             target="_blank"
    117             rel="nofollow ugc"
    118           >
    119             <?php echo $counter . ". " . $entry["title"]; ?>
    120           </a>
    121         </h3>
    122         <!-- Information -->
    123         <div style="width:100%;margin-bottom:1em;">
    124           <em style="margin-left:0.25em;color:var(--border);">
    125             <?php echo date("Y-m-d, H:i", $entry["date"]); ?>
    126           </em>
    127           <em style="margin-left:0.25em;color:var(--border);">
    128             <?php echo $entry["domain"]; ?>
    129           </em>
    130         </div>
    131         <!-- Content -->
    132         <p class="article_content">
    133           <?php echo $entry["content"]; ?>
    134         </p>
    135       </section>
    136 
    137       <?php
    138         }
    139       ?>
    140 
    141     </main>
    142 
    143     <footer>
    144       <h4>Disclaimer:</h4>
    145       <p>
    146         The news headlines, content or attitudes of the editors and authors of
    147         the news outlets, blogs and newspapers featured here do not necessarily
    148         reflect the opinions and attitudes of the operators of this website.
    149         This is a news aggregator together content from many different
    150         sources, but has no influence on the editorial content directly.
    151       </p>
    152     </footer>
    153 
    154   </body>
    155 </html>