Initial commit: simpleblog
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{ post.title }} · {{ site_title }}{% endblock %}
|
||||
{% block meta_description %}{{ post.excerpt or post.body|striptags|truncate(160, True, '…') }}{% endblock %}
|
||||
{% block robots %}{% if preview %}noindex, nofollow{% else %}index, follow{% endif %}{% endblock %}
|
||||
{% block og_type %}article{% endblock %}
|
||||
{% block og_title %}{{ post.title }}{% endblock %}
|
||||
{% block og_description %}{{ post.excerpt or post.body|striptags|truncate(160, True, '…') }}{% endblock %}
|
||||
{% block twitter_title %}{{ post.title }}{% endblock %}
|
||||
{% block twitter_description %}{{ post.excerpt or post.body|striptags|truncate(160, True, '…') }}{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
{# Structured data for search engines (head only — no visual change). #}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"headline": {{ post.title|tojson }},
|
||||
"datePublished": {{ post.created_at|replace(' ', 'T')|tojson }},
|
||||
"dateModified": {{ post.updated_at|replace(' ', 'T')|tojson }},
|
||||
"author": {"@type": "Person", "name": {{ post.author|tojson }}},
|
||||
{% if og_image %}"image": {{ og_image|tojson }},
|
||||
{% endif %}"url": {{ request.url.split('?')[0]|tojson }}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<nav class="breadcrumb">
|
||||
<a href="{{ url_for('public.index') }}">Home</a>
|
||||
<span>›</span>
|
||||
<a href="{{ url_for('public.category', slug=cat_slug) }}">{{ post.category }}</a>
|
||||
<span>›</span>
|
||||
<span>{{ post.title }}</span>
|
||||
</nav>
|
||||
|
||||
{% if preview %}
|
||||
<div class="preview-banner">
|
||||
<strong>Draft preview.</strong> This post is not public yet.
|
||||
<a href="{{ url_for('admin.post_edit', pid=post.id) }}">Back to the editor</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<article class="single-post">
|
||||
<h1 class="post-title">{{ post.title }}</h1>
|
||||
<div class="post-meta">
|
||||
<span><strong>{{ parse_date(post.created_at) }}</strong></span>
|
||||
<span>by {{ post.author }}</span>
|
||||
{% if post.category %}<span>{{ post.category }}</span>{% endif %}
|
||||
{% if post.tags %}<span>Tags: {% for t in post.tags|tag_list %}<a href="{{ url_for('public.tag', slug=t.slug) }}">{{ t.name }}</a>{% if not loop.last %}, {% endif %}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
<div class="entry-content">
|
||||
{{ render_markdown(post.body) }}
|
||||
</div>
|
||||
<div class="post-share">
|
||||
Published on {{ parse_date(post.created_at) }} in {{ post.category }}.
|
||||
</div>
|
||||
</article>
|
||||
|
||||
{# comments.html renders its own <section> + "Comments" heading; wrapping it
|
||||
here duplicated both. #}
|
||||
{% if related %}
|
||||
<section class="related-posts" aria-label="Related posts">
|
||||
<h2 class="page-heading">{% if related_fallback %}More from the blog{% else %}Related posts{% endif %}</h2>
|
||||
<div class="related-grid">
|
||||
{% for r in related %}
|
||||
<article class="related-card">
|
||||
<h3><a href="{{ url_for('public.post', slug=r.slug) }}">{{ r.title }}</a></h3>
|
||||
<div class="post-meta">
|
||||
<span>{{ parse_date(r.created_at) }}</span>
|
||||
{% if r.category %}<span>{{ r.category }}</span>{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if not preview %}{% include "comments.html" %}{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user