blog posts
This commit is contained in:
@@ -12,8 +12,10 @@
|
||||
<body>
|
||||
{{ include('components/_navbar.html.twig') }}
|
||||
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
{% block main %}
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
47
templates/blog_post.html.twig
Normal file
47
templates/blog_post.html.twig
Normal file
@@ -0,0 +1,47 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% if post %}
|
||||
<article class="h-entry">
|
||||
<aside>
|
||||
<span>
|
||||
This is a blog post by
|
||||
<a class="p-author h-card" href="/">Joe Carstairs</a>.
|
||||
</span>
|
||||
<p>
|
||||
Published: <time class="dt-published">{{ post.publishedDate.format('c') }}
|
||||
</p>
|
||||
{% if post.updatedDate %}}
|
||||
<p>
|
||||
Updated: <time class="dt-updated">{{ post.updatedDate.format('c') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<span hidden>
|
||||
<a class="u-url uid" href="{{ url('blog_post', { slug: post.slug }) }}">
|
||||
Permalink
|
||||
</a>
|
||||
</span>
|
||||
</aside>
|
||||
|
||||
<header>
|
||||
<h1 class="p-name">{% apply markdown_to_html %}{{ post.title }}{% endapply %}</h1>
|
||||
<p class="p-summary">
|
||||
{% apply markdown_to_html %}{{ post.description }}{% endapply %}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
|
||||
{% apply markdown_to_html %}
|
||||
<section class="e-content">
|
||||
{{ post.content }}
|
||||
</section>
|
||||
{% endapply %}
|
||||
</article>
|
||||
{% else %}
|
||||
<section>
|
||||
<h1>Post not found</h1>
|
||||
<p>I don't have a blog post '{{ slug }}'.</p>
|
||||
<p>Go back to <a href="{{ path('blog_posts') }}">Blog</a>.</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
81
templates/blog_posts.html.twig
Normal file
81
templates/blog_posts.html.twig
Normal file
@@ -0,0 +1,81 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<section class="h-feed">
|
||||
<h1 class="p-name">Joe Carstairs' blog</h1>
|
||||
|
||||
<p hidden>
|
||||
This blog is written by
|
||||
<a class="p-author h-card" href="{{ url('index') }}">
|
||||
Joe Carstairs
|
||||
</a>.
|
||||
</p>
|
||||
<p hidden>
|
||||
<a class="u-url" href="{{ url('blog_posts') }}">Permalink</a>
|
||||
</p>
|
||||
|
||||
{% if years %}
|
||||
<nav class="skip-to">
|
||||
Skip to:
|
||||
<ul>
|
||||
{% for year in years %}
|
||||
<li><a href="#{{ year }}">{{ year }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{% for year in years %}
|
||||
<h2 id="{{ year }}">{{ year }}</h2>
|
||||
|
||||
<nav class="skip-to">
|
||||
Skip to:
|
||||
<ul>
|
||||
{% for month in months[year] %}
|
||||
<li><a href="#{{ year }}-{{ month }}">
|
||||
{{ monthNames[month] }} <span class="visually-hidden">{{ year }}</span>
|
||||
</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{% for month in months[year] %}
|
||||
<h3 id="{{ year }}-{{ month }}">{{ monthNames[month] }}</h3>
|
||||
|
||||
{% for post in posts[year][month] %}
|
||||
<section class="h-entry">
|
||||
<a class="u-url" href="{{ path('blog_post', { 'slug': post.slug }) }}">
|
||||
<h4 class="p-name">
|
||||
{{ post.title }}
|
||||
</h4>
|
||||
|
||||
<p>
|
||||
Added:
|
||||
<time class="dt-published" datetime="{{ post.publishedDate.format('c') }}">
|
||||
{{ post.publishedDate.format('j F Y') }}
|
||||
</time>
|
||||
</p>
|
||||
|
||||
{% if post.updatedDate %}
|
||||
<p>
|
||||
Updated:
|
||||
<time class="dt-updated" datetime="{{ post.updatedDate.format('c') }}">
|
||||
{{ post.updatedDate.format('j F Y') }}
|
||||
</time>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<section class="p-summary">
|
||||
{% apply markdown_to_html %}
|
||||
{{ post.description|markdown_to_html|striptags('<i><em><b><strong><sup><p>')|html_to_markdown }}
|
||||
{% endapply %}
|
||||
</section>
|
||||
</a>
|
||||
</section>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p>I have no blog posts.</p>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -4,7 +4,7 @@
|
||||
<a href="/">Home</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/blog">Blog</a>
|
||||
<a href="{{ path('blog_posts') }}">Blog</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('notes') }}">Notes</a>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<link rel="stylesheet" href="/css/reset.css" />
|
||||
<link rel="stylesheet" href="/css/base.css" />
|
||||
<link rel="stylesheet" href="/css/hcard.css" />
|
||||
<link rel="stylesheet" href="/css/feed.css" />
|
||||
{% if isFeed|default(false) %}
|
||||
<link rel="stylesheet" href="/css/feed.css" />
|
||||
{% endif %}
|
||||
{% if isFeedEntry|default(false) %}
|
||||
<link rel="stylesheet" href="/css/feed-entry.css" />
|
||||
{% endif %}
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% block main %}
|
||||
{% if note %}
|
||||
<section class="h-entry">
|
||||
<h1 class="p-name">Note {{ note.slug }}</h1>
|
||||
<a hidden class="p-author h-card" href="{{ url('index') }}">Joe Carstairs</a>
|
||||
<a hidden class="u-url" href="{{ url('note', { slug: note.slug }) }}">Permalink</a>
|
||||
<time class="dt-published">{{ note.publishedDate.format('c') }}
|
||||
{% apply markdown_to_html %}
|
||||
<section class="e-content">
|
||||
{{ note.content }}
|
||||
</section>
|
||||
{% endapply %}
|
||||
</section>
|
||||
<article class="h-entry">
|
||||
<header>
|
||||
<h1 class="p-name">Note {{ note.slug }}</h1>
|
||||
<p hidden><a class="p-author h-card" href="{{ url('index') }}">Joe Carstairs</a></p>
|
||||
<p hidden <a class="u-url" href="{{ url('note', { slug: note.slug }) }}">Permalink</a></p>
|
||||
<p>Added: <time class="dt-published">{{ note.publishedDate.format('c') }}</time></p>
|
||||
</header>
|
||||
|
||||
<section class="e-content">
|
||||
{{ note.content|markdown_to_html }}
|
||||
</section>
|
||||
</article>
|
||||
{% else %}
|
||||
<section>
|
||||
<h1>Note not found</h1>
|
||||
<p>I don't have a note '{{ slug }}'.</p>
|
||||
<p>Go back to <a href="/notes">Notes</a>.</p>
|
||||
</section>
|
||||
<main>
|
||||
<header>
|
||||
<h1>Note not found</h1>
|
||||
</header>
|
||||
<section>
|
||||
<p>I don't have a note '{{ slug }}'.</p>
|
||||
<p>Go back to <a href="/notes">Notes</a>.</p>
|
||||
</section>
|
||||
</main>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -14,14 +14,16 @@
|
||||
<a class="u-url" href="{{ url('notes') }}">Permalink</a>
|
||||
</p>
|
||||
|
||||
<nav class="skip-to">
|
||||
Skip to:
|
||||
<ul>
|
||||
{% for year in years %}
|
||||
<li><a href="#{{ year }}">{{ year }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% if years %}
|
||||
<nav class="skip-to">
|
||||
Skip to:
|
||||
<ul>
|
||||
{% for year in years %}
|
||||
<li><a href="#{{ year }}">{{ year }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{% for year in years %}
|
||||
<h2 id="{{ year }}">{{ year }}</h2>
|
||||
@@ -42,18 +44,23 @@
|
||||
|
||||
{% for note in notes[year][month] %}
|
||||
<section class="h-entry">
|
||||
<h4><a class="p-name u-url" href="{{ url('note', { slug: note.slug }) }}">
|
||||
Note {{ note.slug }}
|
||||
</a></h4>
|
||||
<time class="dt-published" datetime="{{ note.publishedDate.format('c') }}">
|
||||
{{ note.publishedDate.format('j F Y') }}
|
||||
</time>
|
||||
<a class="u-url" href="{{ url('note', { slug: note.slug }) }}">
|
||||
<h4 class="p-name">
|
||||
Note {{ note.slug }}
|
||||
</h4>
|
||||
<p>
|
||||
Added:
|
||||
<time class="dt-published" datetime="{{ note.publishedDate.format('c') }}">
|
||||
{{ note.publishedDate.format('j F Y') }}
|
||||
</time>
|
||||
</p>
|
||||
|
||||
<section class="e-content">
|
||||
{% apply markdown_to_html %}
|
||||
{{ note.content }}
|
||||
{% endapply %}
|
||||
</section>
|
||||
<section class="e-content">
|
||||
{% apply markdown_to_html %}
|
||||
{{ note.content|markdown_to_html|striptags('<i><em><b><strong><sup><p>')|html_to_markdown }}
|
||||
{% endapply %}
|
||||
</section>
|
||||
</a>
|
||||
</section>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user