Add feeds page

This commit is contained in:
Yarmo Mackenbach 2020-06-20 19:46:57 +02:00
parent de94d8bba4
commit 970c92c8b8
4 changed files with 36 additions and 9 deletions

View File

@ -9,12 +9,13 @@ $router = new AltoRouter();
// Router mapping
$router->map('GET', '/', function() {}, 'home');
$router->map('GET', '/about', function() {}, 'about');
$router->map('GET', '/rss', function() {}, 'rss');
$router->map('GET', '/rss.xml', function() {}, 'rss-xml');
$router->map('GET', '/rss/all', function() {}, 'rss-all');
$router->map('GET', '/rss/blog', function() {}, 'rss-blog');
$router->map('GET', '/rss/notes', function() {}, 'rss-notes');
$router->map('GET', '/about', function() {}, 'about');
$router->map('GET', '/feeds', function() {}, 'feeds');
$router->map('GET', '/blog', function() {}, 'blog');
$router->map('GET', '/blog/[*:slug]', function() {}, 'blog_post');
$router->map('GET', '/notes', function() {}, 'notes');
@ -87,6 +88,11 @@ if ($match['name'] == 'rss-notes') {
$variables['feed']['linkself'] = "https://yarmo.eu/rss/notes";
}
// If we are dealing with the feeds
if ($match['name'] == 'feeds') {
$variables['title'] = 'Feeds — Yarmo Mackenbach';
}
// If we are dealing with the blog
if ($match['name'] == 'blog') {
$variables['posts'] = getBlogPosts($variables['params']);
@ -190,6 +196,10 @@ if ($environment === 'production') {
getRSS($variables);
break;
case 'feeds':
\Phug\Optimizer::call('displayFile', ['feeds', $variables], $options);
break;
case 'blog':
\Phug\Optimizer::call('displayFile', ['blog', $variables], $options);
break;
@ -270,6 +280,11 @@ if(is_array($match) && is_callable($match['target'])) {
getRSS($variables);
break;
case 'feeds':
Phug::displayFile('feeds', $variables, $options);
break;
break;
case 'blog':
Phug::displayFile('blog', $variables, $options);
break;

View File

@ -12,6 +12,8 @@ block content
| |
a(href="/notes") notes
| |
a(href="/feeds") feeds
| |
a(href="/foss") FOSS
| |
a(href="/projects") projects

18
views/feeds.pug Normal file
View File

@ -0,0 +1,18 @@
extends layout
block content
header
nav
a(href="/about") about me
| > feeds
h1
| Feeds
main
ul
li
a(href="/rss/all") RSS blog and notes
li
a(href="/rss/blog") RSS blog
li
a(href="/rss/notes") RSS notes

View File

@ -16,14 +16,6 @@ block content
h1 Yarmo's notes
main
p
| RSS feeds:
a(href="/rss/all") blog and notes
| |
a(href="/rss/blog") blog
| |
a(href="/rss/notes") notes
.longform_list
each $item in $posts
+entry($item)