index.php (3495B)
1 <!-- SPDX-License-Identifier: AGPL-3.0-or-later
2 SPDX-FileCopyrightText: 2021-2024 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>Newsplanet - Planet-style newsfeed</title>
11 <meta name="description" content="Planet-style newsfeed">
12 <link rel="icon" type="image/png" href="assets/favicon.png">
13 <link rel="icon" type="image/png" sizes="16x16" href="assets/favicon_16.png">
14 <link rel="icon" type="image/png" sizes="32x32" href="assets/favicon_32.png">
15 <link rel="icon" type="image/png" sizes="64x64" href="assets/favicon_64.png">
16 <link rel="icon" type="image/png" sizes="128x128" href="assets/favicon_128.png">
17 <link rel="apple-touch-icon" href="assets/favicon.png">
18 <link rel="stylesheet" type="text/css" href="assets/css/simple.min.css">
19 <link rel="alternate" title="[%feed.title %]" type="application/atom+xml" href="rss.xml">
20 <link crossorigin="use-credentials" rel="manifest" href="manifest.json">
21 <meta name="viewport" content="width=device-width, initial-scale=1.0">
22 <style>
23 /* Always scroll smoothly */
24 * {
25 scroll-behavior: smooth;
26 }
27 /* Hide linebreaks inside articles */
28 section > br,
29 section > p > br
30 {
31 display: none;
32 }
33 /* Only show first paragraph of article content (typically the summary) */
34 .article_content > *:nth-child(n + 2) {
35 display: none;
36 }
37 .article_content {
38 margin-bottom: 1.5em;
39 }
40 /* Content should not be weighted */
41 .article_content > strong {
42 font-weight: normal;
43 }
44 /* Hide iframes and images in case they are not filtered out */
45 .article_content > iframe,
46 .article_content > img,
47 .article_content > * > img,
48 .article_content > * > iframe
49 {
50 display: none;
51 }
52 /* Rules for buttons row */
53 .button-row {
54 width: 100%;
55 display: flex;
56 }
57 .button-row > .button {
58 display: inline-flex;
59 margin-left: 5px;
60 margin-right: 5px;
61 max-height: 50px;
62 }
63 a.button > img {
64 height: 30px;
65 width: auto;
66 }
67 </style>
68 </head>
69
70 <body>
71
72 <header>
73 <nav>
74 <!-- Source Code -->
75 <a href="https://src.jayvii.de/pub/newsplanet/" target="_blank">
76 Source
77 </a>
78 <!-- Privacy Policy -->
79 <a href="https://www.jayvii.de/privacy/#newsjayviide" target="_blank">
80 Privacy
81 </a>
82 </nav>
83 <!-- Feed Title -->
84 <h1>Newsplanet</h1>
85 </header>
86
87 <main>
88
89 <p>Planet-Style Newsfeed generated with perlanet.</p>
90 <?php
91 foreach (glob("[a-z]*.yaml") as $yamlfile) {
92 $yaml = explode(PHP_EOL, file_get_contents($yamlfile));
93 $title_arr = array_values(preg_grep("/^title:.*$/", $yaml));
94 $title = preg_replace("/^title:\s*/", "", $title_arr[0]);
95 $desc_arr = array_values(preg_grep("/^description:.*$/", $yaml));
96 $desc = preg_replace("/^description:\s*/", "", $desc_arr[0]);
97 $url_arr = array_values(preg_grep("/^url:.*$/", $yaml));
98 $url = preg_replace("/^url:\s*/", "", $url_arr[0]);
99 ?>
100
101 <section>
102 <h2><?php echo $title; ?></h2>
103 <p><?php echo $desc; ?></p>
104 <a href="<?php echo $url; ?>" class="button"><?php echo $title; ?></a>
105 </section>
106
107 <?php
108 }
109 ?>
110
111 </main>
112 </body>
113 </html>