This commit is contained in:
parent
862c70be2c
commit
ee4cc77c85
44
index.php
44
index.php
@ -35,6 +35,7 @@ $router->map('GET', '/contact', function() {}, 'contact');
|
||||
$match = $router->match();
|
||||
|
||||
// Template engine settings and variables
|
||||
$basetitle = 'yarmo';
|
||||
$environment = getenv('ENVIRONMENT') ?: 'production';
|
||||
$options = [
|
||||
'paths' => [
|
||||
@ -50,13 +51,13 @@ $options = [
|
||||
],
|
||||
];
|
||||
$variables = [
|
||||
'title' => 'Yarmo Mackenbach'
|
||||
'title' => $basetitle
|
||||
];
|
||||
|
||||
// If we are dealing with the home page
|
||||
if ($match['name'] == 'home') {
|
||||
$variables['posts'] = getBlogPosts($variables['params']);
|
||||
$variables['title'] = 'Blog — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Blog — '.$basetitle;
|
||||
// $variables['icons'] = getIcons();
|
||||
}
|
||||
|
||||
@ -93,18 +94,23 @@ if ($match['name'] == 'rss-notes') {
|
||||
|
||||
// If we are dealing with the feeds
|
||||
if ($match['name'] == 'feeds') {
|
||||
$variables['title'] = 'Feeds — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Feeds — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with the uses
|
||||
if ($match['name'] == 'uses') {
|
||||
$variables['title'] = 'Uses — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Uses — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with the now
|
||||
if ($match['name'] == 'now') {
|
||||
$variables['title'] = 'Now — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with the blog
|
||||
if ($match['name'] == 'blog') {
|
||||
$variables['posts'] = getBlogPosts($variables['params']);
|
||||
$variables['title'] = 'Blog — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Blog — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with a blog post
|
||||
@ -112,13 +118,13 @@ if ($match['name'] == 'blog_post') {
|
||||
$variables['params']['slug'] = $match['params']['slug'];
|
||||
$variables['post'] = getBlogPosts($variables['params']);
|
||||
$variables['post'] = $variables['post'][0];
|
||||
$variables['title'] = htmlspecialchars_decode(str_replace('·','·',$variables['post']['title'])).' — Yarmo Mackenbach';
|
||||
$variables['title'] = htmlspecialchars_decode(str_replace('·','·',$variables['post']['title'])).' — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with the notes
|
||||
if ($match['name'] == 'notes') {
|
||||
$variables['posts'] = getNotes($variables['params']);
|
||||
$variables['title'] = 'Notes — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Notes — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with a notes post
|
||||
@ -126,13 +132,13 @@ if ($match['name'] == 'notes_post') {
|
||||
$variables['params']['slug'] = $match['params']['slug'];
|
||||
$variables['post'] = getNotes($variables['params']);
|
||||
$variables['post'] = $variables['post'][0];
|
||||
$variables['title'] = htmlspecialchars_decode(str_replace('·','·',$variables['post']['title'])).' — Yarmo Mackenbach';
|
||||
$variables['title'] = htmlspecialchars_decode(str_replace('·','·',$variables['post']['title'])).' — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with the projects
|
||||
if ($match['name'] == 'projects') {
|
||||
$variables['projects'] = getProjects($variables['params']);
|
||||
$variables['title'] = 'Projects — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Projects — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with a project's details
|
||||
@ -140,36 +146,36 @@ if ($match['name'] == 'projects_details') {
|
||||
$variables['params']['slug'] = $match['params']['slug'];
|
||||
$variables['project'] = getProjects($variables['params']);
|
||||
$variables['project'] = $variables['project'][0];
|
||||
$variables['title'] = htmlspecialchars_decode(str_replace('·','·',$variables['project']['title'])).' — Yarmo Mackenbach';
|
||||
$variables['title'] = htmlspecialchars_decode(str_replace('·','·',$variables['project']['title'])).' — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with foss
|
||||
if ($match['name'] == 'foss') {
|
||||
$variables['foss'] = getFOSS();
|
||||
$variables['title'] = 'FOSS — Yarmo Mackenbach';
|
||||
$variables['title'] = 'FOSS — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with vinyl
|
||||
if ($match['name'] == 'vinyl') {
|
||||
$variables['vinyl'] = getVinyl();
|
||||
$variables['albums'] = $variables['vinyl']['albums'];
|
||||
$variables['title'] = 'Vinyl — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Vinyl — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with Albu m Of The Week
|
||||
if ($match['name'] == 'aotw') {
|
||||
$variables['albums'] = getAOTW();
|
||||
$variables['title'] = 'Album Of The Week — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Album Of The Week — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with the pgp page
|
||||
if ($match['name'] == 'pgp') {
|
||||
$variables['title'] = 'PGP — Yarmo Mackenbach';
|
||||
$variables['title'] = 'PGP — '.$basetitle;
|
||||
}
|
||||
|
||||
// If we are dealing with the contact page
|
||||
if ($match['name'] == 'contact') {
|
||||
$variables['title'] = 'Contact me — Yarmo Mackenbach';
|
||||
$variables['title'] = 'Contact me — '.$basetitle;
|
||||
}
|
||||
|
||||
// Add Phug dyninclude
|
||||
@ -212,6 +218,10 @@ if ($environment === 'production') {
|
||||
\Phug\Optimizer::call('displayFile', ['uses', $variables], $options);
|
||||
break;
|
||||
|
||||
case 'now':
|
||||
\Phug\Optimizer::call('displayFile', ['now', $variables], $options);
|
||||
break;
|
||||
|
||||
case 'blog':
|
||||
\Phug\Optimizer::call('displayFile', ['blog', $variables], $options);
|
||||
break;
|
||||
@ -295,11 +305,13 @@ if(is_array($match) && is_callable($match['target'])) {
|
||||
case 'feeds':
|
||||
Phug::displayFile('feeds', $variables, $options);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'uses':
|
||||
Phug::displayFile('uses', $variables, $options);
|
||||
break;
|
||||
|
||||
case 'now':
|
||||
Phug::displayFile('now', $variables, $options);
|
||||
break;
|
||||
|
||||
case 'blog':
|
||||
|
@ -8,6 +8,8 @@ block content
|
||||
| About Me
|
||||
nav
|
||||
| Go to:
|
||||
a(href="/now") now
|
||||
| |
|
||||
a(href="/") blog
|
||||
| |
|
||||
a(href="/notes") notes
|
||||
|
23
views/now.pug
Normal file
23
views/now.pug
Normal file
@ -0,0 +1,23 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
header
|
||||
nav
|
||||
a(href="/about") about me
|
||||
| > now
|
||||
h1
|
||||
| Now
|
||||
|
||||
main
|
||||
h3 Working on
|
||||
ul
|
||||
li recovering from the PhD
|
||||
li finishing a scientific publication
|
||||
li numerous FOSS projects
|
||||
li the search for employment in a whole different field
|
||||
li new music
|
||||
|
||||
h3 Enjoying
|
||||
ul
|
||||
li renovating rooms in my house
|
||||
li becoming a modular synth daddy
|
Loading…
x
Reference in New Issue
Block a user