bingus-blog/templates/index.html

68 lines
2.4 KiB
HTML

{%- import "macros.askama" as macros -%}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="{{ title }}" />
<meta property="og:title" content="{{ title }}" />
<meta property="og:description" content="{{ description }}" />
{% match color %} {% when Some with (color) %}
<meta name="theme-color" content="{{ color }}" />
{% when None %} {% endmatch %}
<title>{{ title }}</title>
<link rel="stylesheet" href="/static/style.css" />
{% if rss %}
<link rel="alternate" type="application/rss+xml" title="{{ title }}" href="/feed.xml" />
{% endif %}
<!-- prettier-br -->
{% if js %}
<script src="/static/date.js" defer></script>
<script src="/static/sort.js" defer></script>
<script src="/static/main.js" defer></script>
{% endif %}
</head>
<body>
<main>
<h1>{{ title }}</h1>
<p>{{ description }}</p>
<h2>posts</h2>
<div>
{% if posts.is_empty() %}<!-- prettier-br -->
there are no posts right now. check back later!<!-- prettier-br -->
{% else %}<!-- prettier-br -->
{% if js %}<!-- prettier-br -->
<form id="sort" style="display: none">
sort by: <br />
<input type="radio" name="sort" id="sort-date" value="date" {% if sort == Sort::Date %} checked {% endif %} />
<label for="sort-date">date</label>
<input type="radio" name="sort" id="sort-name" value="name" {% if sort == Sort::Name %} checked {% endif %} />
<label for="sort-name">name</label>
</form>
{% endif %}<!-- prettier-br -->
<div id="posts">
{% for post in posts %}
<div class="post">
<a href="/posts/{{ post.name }}"><b>{{ post.title }}</b></a>
<span class="post-author">- by {{ post.author }}</span>
<br />
{{ post.description }}<br />
{% call macros::table(post) %}
</div>
{% endfor %}
</div>
{% endif %}<!-- prettier-br -->
</div>
{% let tags = posts|collect_tags %}<!-- prettier-br -->
{% if !tags.is_empty() %}
<h2>tags</h2>
<b><a href="/">clear tags</a></b>
<br />
{% endif %}<!-- prettier-br -->
{% for tag in tags %}
<a href="/?tag={{ tag.0 }}" title="view all posts with this tag">{{ tag.0 }}</a>
<span class="post-author">- {{ tag.1 }} post{% if tag.1 != 1 %}s{%endif %}</span><br />
{% endfor %}
</main>
</body>
</html>