leilukin-tumbleblog/themes/blossom/content/sidebar.twig

102 lines
3.7 KiB
Twig
Raw Normal View History

2024-06-20 14:10:42 +00:00
<div id="sidebar" role="banner">
<h1><a href="{{ url('/') }}">{{ site.name }}</a></h1>
<form class="search_box" action="{{ url('search') }}" method="post" accept-charset="UTF-8" role="search">
<input type="text" id="sidebar_search_field" name="query" value="{{ search is defined ? search | fix(true, true) : '' }}" placeholder="{{ 'Search&hellip;' | translate }}" aria-label="{{ 'Search this blog' | translate }}">
<button type="submit" id="sidebar_search_submit">{{ "Search" | translate }}</button>
</form>
<h2 class="menu_toggle" id="menu"><a role="button" href="#menu">{{ "Menu" | translate }}</a></h2>
<h2 class="menu_toggle"><a role="button" href="#" aria-label="{{ 'Close menu' | translate }}">{{ "Menu" | translate }}</a></h2>
<ul class="navigation sidebar" aria-label="{{ 'Links' | translate }}">
<li>
<a href="{{ url('index') }}">{{ "Blog" | translate }}</a>
</li>
<li>
<a href="{{ mailto(site.email) }}">{{ "Email" | translate }}</a>
</li>
<li>
<a href="{{ url('feed') }}" rel="alternate">{{ "Feed" | translate }}</a>
</li>
{% if visitor.group.can("change_settings", "toggle_extensions") %}
<li>
<a href="{{ url('/', 'AdminController') }}">{{ "Admin" | translate }}</a>
</li>
{% elseif visitor.group.can("add_post") %}
<li>
<a href="{{ url('/', 'AdminController') }}">{{ "Write" | translate }}</a>
</li>
{% elseif visitor.group.can("add_draft") %}
<li>
<a href="{{ url('/', 'AdminController') }}">{{ "Draft" | translate }}</a>
</li>
{% endif %}
{% if visitor.logged_in %}
<li>
<a href="{{ url('controls') }}">{{ "Controls" | translate }}</a>
</li>
<li>
<a href="{{ url('logout') }}">{{ "Log out" | translate }}</a>
</li>
{% else %}
{% if site.can_register %}
<li>
<a href="{{ url('register') }}">{{ "Register" | translate }}</a>
</li>
{% endif %}
<li>
<a href="{{ url('login') }}">{{ "Log in" | translate }}</a>
</li>
{% endif %}
</ul>
{% if module_enabled("categorize") and categorize is not empty %}
<h2 id="label_categories">{{ "Categories" | translate }}</h2>
<ul class="navigation sidebar categories" aria-labelledby="label_categories">
{% for category in categorize %}
<li>
2024-09-05 17:51:48 +00:00
<a href="{{ category.url() }}">{{ category.name | oneof("[Untitled]" | translate) }}</a>
2024-06-20 14:10:42 +00:00
</li>
{% endfor %}
</ul>
{% endif %}
{% if theme.pages_list() is not empty %}
<h2 id="label_my_pages">{{ "Pages" | translate }}</h2>
<ul class="navigation sidebar my_pages" aria-labelledby="label_my_pages">
{% for item in theme.pages_list() %}
<li class="page">
{{ "&nbsp;" | repeat((item.depth - 1) * 4) }}<a href="{{ item.url() }}">{{ item.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if route.action == "view" and post is defined and theme.related_posts(post) is not empty %}
<h2 id="label_related_posts">{{ "Related Posts" | translate }}</h2>
<ul class="navigation sidebar related_posts" aria-labelledby="label_related_posts">
{% for post in theme.related_posts(post) %}
<li>
<a href="{{ post.url() }}">{{ post.title() | striptags | normalize | oneof(post.slug) | truncate(30) }}</a>
</li>
{% endfor %}
</ul>
{% elseif theme.recent_posts() is not empty %}
<h2 id="label_recent_posts">{{ "Recent Posts" | translate }}</h2>
<ul class="navigation sidebar recent_posts" aria-labelledby="label_recent_posts">
{% for post in theme.recent_posts() %}
<li>
<a href="{{ post.url() }}">{{ post.title() | striptags | normalize | oneof(post.slug) | truncate(30) }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if theme.archives_list() is not empty %}
<h2 id="label_archive_list">
<a href="{{ url('archive') }}" rel="archives">{{ "Archive" | translate }}</a>
</h2>
<ul class="navigation sidebar archive_list" aria-labelledby="label_archive_list">
{% for archive in theme.archives_list() %}
<li>
2024-09-05 17:51:48 +00:00
<a href="{{ archive.url }}">{{ archive.when | time("F Y" | translate, "title") }}</a>
2024-06-20 14:10:42 +00:00
</li>
{% endfor %}
</ul>
{% endif %}
</div>