Created
November 12, 2022 09:20
-
-
Save officialrajdeepsingh/84441cfc86cdb2ca7107c6a83447d479 to your computer and use it in GitHub Desktop.
createtemplates/card.njk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container px-6 py-10 mx-auto"> | |
<div class="mt-8 lg:-mx-6 lg:flex lg:items-center"> | |
<img class="object-cover border-none w-full lg:mx-6 lg:w-1/2 rounded-xl h-72 lg:h-96" src="{{ post.data.image }}" alt="{{ post.data.title }}"> | |
<div class="mt-6 lg:w-1/2 lg:mt-0 lg:mx-6 "> | |
<a class="text-sm text-blue-500 uppercase" href="/category/{{ post.data.category | category }}" > | |
{{ post.data.category | category }} | |
</a> | |
<a href="{{ post.data.url }}" class="block mt-4 text-2xl font-semibold text-gray-800 hover:text-gray-500 dark:text-white md:text-3xl">{{ post.data.title }}</a> | |
<p class="mt-3 text-sm text-gray-500 dark:text-gray-300 md:text-sm"> | |
{{ post.data.description }} | |
</p> | |
{# Reusable button component #} | |
{{ comp.button({ text: "Read more",url: "{{ post.data.url }}"}) | safe }} | |
<div class="flex items-center mt-6"> | |
{% if post.data.author.length <= 2 %} | |
{% for author in post.data.author %} | |
<img class="border-none object-cover object-center w-10 h-10 rounded-full" src="{{ author.image}}" alt="{{ author.author_name}}"> | |
<div class="mx-4"> | |
<a href="{{author.url}}" class="text-sm text-gray-700 dark:text-gray-200"> | |
{{ author.author_name}}</a> | |
<p class="text-sm text-gray-500 dark:text-gray-400"> | |
{{author.job}} | |
</p> | |
</div> | |
{% endfor %} | |
{% else %} | |
<img class="border-none object-cover object-center w-10 h-10 rounded-full" src="{{ post.data.author.image}}" alt="{{ post.data.author.name}}"> | |
<div class="mx-4"> | |
<a href="{{ post.data.author.url}}" class="text-sm text-gray-700 dark:text-gray-200"> | |
{{ post.data.author.author_name}}</a> | |
<p class="text-sm text-gray-500 dark:text-gray-400"> | |
{{post.data.author.job}} | |
</p> | |
</div> | |
{% endif %} | |
</div> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment