pub / newsplanet

Planet-Style Newsfeed generated with perlanet
git clone https://src.jayvii.de/pub/newsplanet.git
Home | Log | Files | Exports | Refs | README | RSS

commit 2f9fe7e88aab1e64db8f11d85bdbdfe74f5f97e5
parent 262572a56deda8cd172af7ed94c3d358f07972a4
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Thu, 12 Dec 2024 11:34:12 +0100

feat: generate index page with PHP

Diffstat:
Mcentre.yaml | 2+-
Dindex.html | 101-------------------------------------------------------------------------------
Aindex.php | 113+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mleft.yaml | 2+-
4 files changed, 115 insertions(+), 103 deletions(-)

diff --git a/centre.yaml b/centre.yaml @@ -1,5 +1,5 @@ title: Newsplanet (Centre) -description: Planet-style news feed +description: News from outlets and journalistic sources around the political centre in the left-right spectrum. url: https://news.jayvii.de/centre.html entries: 5000 entries_per_feed: 10 diff --git a/index.html b/index.html @@ -1,101 +0,0 @@ -<!-- SPDX-License-Identifier: AGPL-3.0-or-later - SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de> ---> - -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Newsplanet - Planet-style newsfeed</title> - <meta name="description" content="Planet-style newsfeed"> - <link rel="icon" type="image/png" href="assets/favicon.png"> - <link rel="icon" type="image/png" sizes="16x16" href="assets/favicon_16.png"> - <link rel="icon" type="image/png" sizes="32x32" href="assets/favicon_32.png"> - <link rel="icon" type="image/png" sizes="64x64" href="assets/favicon_64.png"> - <link rel="icon" type="image/png" sizes="128x128" href="assets/favicon_128.png"> - <link rel="apple-touch-icon" href="assets/favicon.png"> - <link rel="stylesheet" type="text/css" href="assets/css/simple.min.css"> - <link rel="alternate" title="[%feed.title %]" type="application/atom+xml" href="rss.xml"> - <link crossorigin="use-credentials" rel="manifest" href="manifest.json"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <style> - /* Always scroll smoothly */ - * { - scroll-behavior: smooth; - } - /* Hide linebreaks inside articles */ - section > br, - section > p > br - { - display: none; - } - /* Only show first paragraph of article content (typically the summary) */ - .article_content > *:nth-child(n + 2) { - display: none; - } - .article_content { - margin-bottom: 1.5em; - } - /* Content should not be weighted */ - .article_content > strong { - font-weight: normal; - } - /* Hide iframes and images in case they are not filtered out */ - .article_content > iframe, - .article_content > img, - .article_content > * > img, - .article_content > * > iframe - { - display: none; - } - /* Rules for buttons row */ - .button-row { - width: 100%; - display: flex; - } - .button-row > .button { - display: inline-flex; - margin-left: 5px; - margin-right: 5px; - max-height: 50px; - } - a.button > img { - height: 30px; - width: auto; - } - </style> - </head> - - <body> - - <header> - <nav> - <!-- Source Code --> - <a href="https://src.jayvii.de/pub/newsplanet/" target="_blank"> - Source - </a> - <!-- Privacy Policy --> - <a href="https://www.jayvii.de/privacy/#newsjayviide" target="_blank"> - Privacy - </a> - </nav> - <!-- Feed Title --> - <h1>Newsplanet</h1> - </header> - - <main> - - <p>Planet-Style Newsfeed generated with perlanet.</p> - <p>Two feed categories are currently available:</p> - - <div class="button-row"> - <div style="margin-left:auto;margin-right:auto;"> - <a href="./left.html" class="button">Left</a> - <a href="./centre.html" class="button">Centre</a> - </div> - </div> - - </main> - </body> -</html> diff --git a/index.php b/index.php @@ -0,0 +1,113 @@ +<!-- SPDX-License-Identifier: AGPL-3.0-or-later + SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de> +--> + +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>Newsplanet - Planet-style newsfeed</title> + <meta name="description" content="Planet-style newsfeed"> + <link rel="icon" type="image/png" href="assets/favicon.png"> + <link rel="icon" type="image/png" sizes="16x16" href="assets/favicon_16.png"> + <link rel="icon" type="image/png" sizes="32x32" href="assets/favicon_32.png"> + <link rel="icon" type="image/png" sizes="64x64" href="assets/favicon_64.png"> + <link rel="icon" type="image/png" sizes="128x128" href="assets/favicon_128.png"> + <link rel="apple-touch-icon" href="assets/favicon.png"> + <link rel="stylesheet" type="text/css" href="assets/css/simple.min.css"> + <link rel="alternate" title="[%feed.title %]" type="application/atom+xml" href="rss.xml"> + <link crossorigin="use-credentials" rel="manifest" href="manifest.json"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <style> + /* Always scroll smoothly */ + * { + scroll-behavior: smooth; + } + /* Hide linebreaks inside articles */ + section > br, + section > p > br + { + display: none; + } + /* Only show first paragraph of article content (typically the summary) */ + .article_content > *:nth-child(n + 2) { + display: none; + } + .article_content { + margin-bottom: 1.5em; + } + /* Content should not be weighted */ + .article_content > strong { + font-weight: normal; + } + /* Hide iframes and images in case they are not filtered out */ + .article_content > iframe, + .article_content > img, + .article_content > * > img, + .article_content > * > iframe + { + display: none; + } + /* Rules for buttons row */ + .button-row { + width: 100%; + display: flex; + } + .button-row > .button { + display: inline-flex; + margin-left: 5px; + margin-right: 5px; + max-height: 50px; + } + a.button > img { + height: 30px; + width: auto; + } + </style> + </head> + + <body> + + <header> + <nav> + <!-- Source Code --> + <a href="https://src.jayvii.de/pub/newsplanet/" target="_blank"> + Source + </a> + <!-- Privacy Policy --> + <a href="https://www.jayvii.de/privacy/#newsjayviide" target="_blank"> + Privacy + </a> + </nav> + <!-- Feed Title --> + <h1>Newsplanet</h1> + </header> + + <main> + + <p>Planet-Style Newsfeed generated with perlanet.</p> +<?php + foreach (glob("[a-z]*.yaml") as $yamlfile) { + $yaml = explode(PHP_EOL, file_get_contents($yamlfile)); + $title_arr = array_values(preg_grep("/^title:.*$/", $yaml)); + $title = preg_replace("/^title:\s*/", "", $title_arr[0]); + $desc_arr = array_values(preg_grep("/^description:.*$/", $yaml)); + $desc = preg_replace("/^description:\s*/", "", $desc_arr[0]); + $url_arr = array_values(preg_grep("/^url:.*$/", $yaml)); + $url = preg_replace("/^url:\s*/", "", $url_arr[0]); +?> + + <section> + <h2><?php echo $title; ?></h2> + <p><?php echo $desc; ?></p> + <a href="<?php echo $url; ?>" class="button"> + </section> + +<?php + } +?> + + </main> + </body> +</html> diff --git a/left.yaml b/left.yaml @@ -1,5 +1,5 @@ title: Newsplanet (Left) -description: Planet-style news feed +description: News from outlets and journalistic sources from the political left. url: https://news.jayvii.de/left.html entries: 5000 entries_per_feed: 20