From 970c92c8b8d22473040bd67e1e174de4b76a6bd5 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Sat, 20 Jun 2020 19:46:57 +0200 Subject: [PATCH] Add feeds page --- index.php | 17 ++++++++++++++++- views/about.pug | 2 ++ views/feeds.pug | 18 ++++++++++++++++++ views/notes.pug | 8 -------- 4 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 views/feeds.pug diff --git a/index.php b/index.php index c81cd43..1213713 100644 --- a/index.php +++ b/index.php @@ -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; diff --git a/views/about.pug b/views/about.pug index 7f6c274..6aad152 100644 --- a/views/about.pug +++ b/views/about.pug @@ -12,6 +12,8 @@ block content | | a(href="/notes") notes | | + a(href="/feeds") feeds + | | a(href="/foss") FOSS | | a(href="/projects") projects diff --git a/views/feeds.pug b/views/feeds.pug new file mode 100644 index 0000000..f338f89 --- /dev/null +++ b/views/feeds.pug @@ -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 diff --git a/views/notes.pug b/views/notes.pug index 6d5f3a9..8d96450 100644 --- a/views/notes.pug +++ b/views/notes.pug @@ -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)