website/templates/categories/single.html

183 lines
10 KiB
HTML
Raw Permalink Normal View History

2024-04-06 00:24:53 +02:00
{% extends "layout.html" %}
{% block rss %}
{% set rss_path = "categories/" ~ term.name ~ "/rss.xml" %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{get_url(path=rss_path, trailing_slash=false)}}">
{% endblock rss %}
{% block content %}
<div class="flex items-center flex-col mt-10">
<h1 class="text-2xl text-bold mb-6">
Category : {{ term.name }}
<button id="rss" type="button" class=" bg-gray-200 text-gray-800 hover:text-gray-900 dark:bg-gray-800 dark:text-gray-400 dark:hover:text-white p-1 rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white">
<a href="rss.xml">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
<title>RSS</title>
<path d="M15,56a7,7,0,1,1,7-7A7,7,0,0,1,15,56Zm0-12a5,5,0,1,0,5,5A5,5,0,0,0,15,44Z"/>
<path d="M37.47,59a5.51,5.51,0,0,1-5.5-5.5A20.53,20.53,0,0,0,11.46,32.95a5.5,5.5,0,1,1,0-11A31.55,31.55,0,0,1,43,53.46,5.51,5.51,0,0,1,37.47,59Zm-26-35a3.5,3.5,0,1,0,0,7A22.53,22.53,0,0,1,34,53.46a3.5,3.5,0,0,0,7,0A29.54,29.54,0,0,0,11.46,23.95Z"/>
<path d="M53.89,58.5a5.51,5.51,0,0,1-5.5-5.5A37.44,37.44,0,0,0,11,15.61a5.5,5.5,0,1,1,0-11A48.45,48.45,0,0,1,59.39,53,5.51,5.51,0,0,1,53.89,58.5ZM11,6.61a3.5,3.5,0,1,0,0,7A39.44,39.44,0,0,1,50.39,53a3.5,3.5,0,0,0,7,0A46.45,46.45,0,0,0,11,6.61Z"/>
</svg>
</a>
</button>
2024-04-06 00:24:53 +02:00
</h1>
<div class="flex flex-col gap-y-6 w-full px-4 sm:w-2/3">
{% if paginator %}
{% set pages = paginator.pages %}
{% else %}
{% set pages = term.pages %}
{% endif %}
{% for page in pages %}
<div class="border border-2 border-gray-200 dark:border-black rounded-xl p-5 shadow-2xl transform transition duration-500 hover:scale-105 bg-gray-200 dark:bg-gray-800">
<div class="flex flex-col py-2 justify-center">
<h2 class="text-2xl text-bold"><a href='{{ page.permalink }}'>{{ page.title }}</a></h2>
<p class="text-bold">{{ page.description }}</p>
</div>
<!-- Read time and word count -->
<div class="flex flex-wrap py-2">
<div class="flex items-center w-1/3">
<div class="flex space-x-3 text-gray-900 dark:text-gray-400">
<span class="flex">
<!-- Icon clock -->
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<span class="ml-1">{{ page.reading_time }} min</span>
</span>
<span class="flex">
<!-- Icon pencil -->
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path>
</svg>
<span class="ml-1">{{ page.word_count }} words</span>
</span>
</div>
</div>
<!-- Author and publish date -->
<div class="flex w-2/3 space-x-3 text-gray-900 dark:text-gray-400 justify-end">
<span class="flex items-center">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
</svg>
<span class="ml-1"><time datetime="{{ page.date }}">Published on {{ page.date | date(format='%B %d, %Y') }}</time></span>
</span>
<span class="flex items-center">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
</svg>
{% if page.extra.author.name %}
<span class="ml-1">{{ page.extra.author.name }}</span>
{% if page.extra.author.avatar %}
<img class="rounded-full h-9 w-9 ml-1" src="{{ page.extra.author.avatar }}"{% if page.extra.author.avatar_alt %} alt="{{ page.extra.author.avatar_alt }}"{% endif %}>
{% endif %}
{% else %}
<span class="ml-1">{{ config.extra.default_author.name }}</span>
<img class="rounded-full h-9 w-9 ml-1" src="{{ config.extra.default_author.avatar }}" alt="{{ config.extra.default_author.avatar_alt }}">
{% endif %}
</span>
</div>
</div>
<!-- Summary -->
<div class="text-bold mt-2">
{{ page.summary | safe }}
<a class="flex py-2" href='{{ page.permalink }}'>
Read More
<svg class="w-6 h-6 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3"></path>
</svg>
</a>
</div>
<!-- Categories and Tags -->
<div class="flex flex-wrap py-2">
<div class="w-2/3">
{% if page.taxonomies.categories %}
<p>
Categories:
{% for category in page.taxonomies.categories %}
<a class="text-gray-900 dark:text-gray-400 flex py-1 items-center" href="{{ get_taxonomy_url(kind='categories', name=category) }}">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path>
</svg>
<span class="pl-1">{{category}}</span>
</a>
{% endfor %}
</p>
{% endif %}
</div>
<div class="w-1/3">
{% if page.taxonomies.tags %}
<p>
Tags:
{% for tag in page.taxonomies.tags %}
<a class="text-gray-900 dark:text-gray-400 flex py-1 items-center" href="{{ get_taxonomy_url(kind='tags', name=tag) }}">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"></path>
</svg>
<span class="pl-1">{{tag}}</span>
</a>
{% endfor %}
</p>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock content %}
{% block pagination %}
{% if paginator.previous or paginator.next %}
<div class="max-w-7xl px-2 sm:px-6 lg:px-8 mx-auto w-full">
<div class="flex items-center justify-between">
{% if not paginator.previous %}
<!-- Disabled -->
<span class="flex items-center border border-gray-400 dark:border-black rounded-lg px-3 py-4 bg-gray-400 text-gray-200">
<svg class="w-7 h-7 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16l-4-4m0 0l4-4m-4 4h18"></path>
</svg>
Previous
</span>
{% else %}
<!-- Active -->
<a class="flex items-center border border-gray-400 dark:border-black rounded-lg text-gray-800 dark:text-gray-300 dark:bg-gray-800 hover:bg-gray-300 dark:hover:bg-gray-600 dark:hover:text-white px-3 py-4 rounded-md text-sm font-medium transform transition duration-500 hover:scale-105 bg-gray-200 dark:bg-gray-800" href="{{ paginator.previous }}" {% if not paginator.previous %}disabled{% endif %}>
<svg class="w-7 h-7 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16l-4-4m0 0l4-4m-4 4h18"></path>
</svg>
Previous
</a>
{% endif %}
<ul class="flex gap-x-2">
{% for pager in range(start=1, end=paginator.number_pagers+1) %}
<li class="">
<a class="p-4 border border-gray-400 dark:border-black rounded-lg text-gray-800 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 hover:text-white rounded-md text-sm font-medium transform transition duration-500 hover:scale-105 {% if paginator.current_index == pager %}bg-blue-500{% else %}bg-gray-200 dark:bg-gray-800{% endif %}" href="{{ paginator.base_url }}{{pager}}" aria-label="Page {{pager}}">
{{pager}}
</a>
</li>
{% endfor %}
</ul>
{% if not paginator.next %}
<!-- Disabled -->
<span class="flex items-center border border-gray-400 dark:border-black rounded-lg px-3 py-4 bg-gray-400 text-gray-200">
Next Page
<svg class="w-7 h-7 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path>
</svg>
</span>
{% else %}
<!-- Active -->
<a class="flex items-center border border-gray-400 dark:border-black rounded-lg text-gray-800 dark:text-gray-300 dark:bg-gray-800 hover:bg-gray-300 dark:hover:bg-gray-600 hover:text-white px-3 py-4 rounded-md text-sm font-medium transform transition duration-500 hover:scale-105 bg-gray-200 dark:bg-gray-800" href="{{ paginator.next }}">
Next page
<svg class="w-7 h-7 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path>
</svg>
</a>
{% endif %}
</div>
</div>
{% endif %}
{% endblock %}