This commit is contained in:
Ben Harris 2016-06-27 20:29:36 -04:00
parent c6b6e5c71a
commit 5c5d65d3de
6 changed files with 12 additions and 22 deletions

1
serv.bat Normal file
View File

@ -0,0 +1 @@
php -S localhost:9000 -t web web/index.php

View File

@ -12,6 +12,10 @@ $blog->get('/', function() use($app, $blogposts) {
$blog->get('/{slug}/', function($slug) use($app, $blogposts) {
if(empty($blogposts[$slug])){
return $app['twig']->render('blog/blog.twig',
['alert' => 'Blog post not found. You may have a typo in your URL.',
'posts' => $blogposts]
);
return $app['twig']->render('blog/info.twig',
['alert' => 'Blog post not found. You may have a typo in your URL.']
);

View File

@ -20,6 +20,10 @@
<small>Ben Harris</small>
</h1>
{% if alert is defined %}
<div class="alert alert-danger" role="alert">{{ alert or "" }}</div>
{% endif %}
{% for slug, post in posts %}
{# <!-- First Blog Post --> #}
<h2>

View File

@ -1,19 +0,0 @@
{% extends "layout.html" %}
{% block title %}Blog | Ben Harris{% endblock %}
{% block header %}
{{ parent() }}
<link rel="stylesheet" href="/static/css/sticky-footer-navbar.css">
{% endblock %}
{% block content %}
<div class="container">
<div class="page-header">
<h1>Blog</h1>
</div>
<div class="alert alert-danger" role="alert">{{ alert }}</div>
</div>
{% endblock %}

View File

@ -1,5 +1,5 @@
---
title: first post
title: My First Post
author: Ben Harris
publish_date: Today
---

View File

@ -1,11 +1,11 @@
---
title: Hello World
author: Ben Harris
publish_date: Yesterday
publish_date: 2016-06-24
---
# Hello world
_BOLD_
__BOLD__
*THANKS*
> How are you today
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque impedit assumenda qui fugit doloremque architecto placeat eum rem. Ratione harum repellat mollitia, unde fugit architecto explicabo amet. Consectetur, totam, voluptas.