:like:
This commit is contained in:
parent
c6b6e5c71a
commit
5c5d65d3de
|
@ -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.']
|
||||
);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 %}
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: first post
|
||||
title: My First Post
|
||||
author: Ben Harris
|
||||
publish_date: Today
|
||||
---
|
||||
|
|
|
@ -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.
|
Loading…
Reference in New Issue