introducing templating inheritance and macros
This commit is contained in:
parent
7fe997acff
commit
2e7a81d7c7
11 changed files with 206 additions and 230 deletions
|
@ -1,35 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:title" content="{{ username }}' blog" />
|
||||
<meta property="og:description" content="List of all posts" />
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
{% extends "base.html" %}
|
||||
{% import "article.html.macro" as article_macro %}
|
||||
|
||||
<title> All posts </title>
|
||||
<link rel="stylesheet" href="/static/css/blog.css">
|
||||
<link rel="shortcut icon" type="image/jpg" href="/static/favicon.ico"/>
|
||||
</head>
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<meta property="og:title" content="{{ username }}' blog" />
|
||||
<meta property="og:description" content="List of all posts" />
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
<title> All posts </title>
|
||||
{% endblock head %}
|
||||
|
||||
<body>
|
||||
<h1><a href="/" class="post-link" style="text-decoration:none;color:black;">{{ username }}' blog</a></h1>
|
||||
<p style="text-align: right">
|
||||
<a href="/about">About</a>
|
||||
<a href="/">Last 5 posts</a>
|
||||
</p>
|
||||
<ul>
|
||||
{% for post in posts %}
|
||||
<article>
|
||||
<div>
|
||||
<a href="/id/{{ post.id }}" class="post-link">[link]</a>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<h2 class="post-title">{{ post.title }}</h2>
|
||||
<sub class="post-publish-date"> {{ post.publish_date | date(format="%Y-%m-%d at %H:%M") }}</sub>
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
{% block content %}
|
||||
<h1><a href="/" class="post-link" style="text-decoration:none;color:black;">{{ username }} blog</a></h1>
|
||||
<p style="text-align: right">
|
||||
<a href="/about">About</a>
|
||||
<a href="/">Last 5 posts</a>
|
||||
</p>
|
||||
<ul>
|
||||
{% for post in posts %}
|
||||
{{ article_macro::article(id=post.id,title=post.title,body=post.body,publish_date=post.publish_date) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endblock content %}
|
Loading…
Add table
Add a link
Reference in a new issue