automated featured blog display

This commit is contained in:
timurgordon
2022-02-22 22:40:15 +03:00
parent 267a0fb061
commit 228c93b9c1
9 changed files with 75 additions and 44 deletions

View File

@@ -1,9 +1,24 @@
{% extends "_default/base.html" %}
<!-- blog template
the template for displaying the blog page.
consists of a featured blog row,
a paginated list of posts (sorted by date),
and a side nav for category and featured post navigation
-->
{% block content %}
<main class="pt-16">
{%- set section = get_section(path="blog/featured/_index.md") %}
<!--sets global featured variable as the most recent post with the isFeatured tag-->
{%- set section = get_section(path="blog/_index.md") %}
{% for page in section.pages %}
{% if page.extra.isFeatured %}
{%- set_global featured = page %}
{% break %}
{% endif %}
{% endfor %}
{% include "partials/featuredBlog.html" %}
<div class="flex">

View File

@@ -2,11 +2,13 @@
{% block content %}
<!-- Default page template for blog posts and basic informative markdown files -->
<main class="pt-16">
<div class="sm:w-5/6 md:w-4/5 mr-auto ml-auto px-6 lg:px-16 xl:w-11/12">
<img src="/images/threefold_blog.png" alt="">
<img class="max-h-60 sm:max-h-60 md:max-h-80 lg:max-h-96 mx-auto" src={{"/" ~ page.extra.imgPath}} alt="">
<div>
<article class="article lg:w-7/12 mx-auto">
<h1 class="tracking-tight pt-12 lg:pt-12 2xl:pt-32 text-5xl text-left
<h1 class="tracking-tight pt-8 lg:pt-8 2xl:pt-24 text-5xl text-left
text-5xl fw-500 leading-snug font-normal mb-10">
{{ page.title }}
</h1>
@@ -17,5 +19,6 @@
</article>
</div>
</div>
</main>
{% endblock content %}

View File

@@ -3,16 +3,25 @@
<div class="lg:pt-24 flex flex-col mb-12 mr-24">
<h4 class="text-base not-italic font-medium leading-6 text-gray-600 mb-6"> FILTER POSTS BY</h4>
<a class="mb-3" href="/blog">All</a>
<a class="mb-3" href="/categories/engineering">Engineering</a>
<a class="mb-3" href="/categories/community">Community</a>
<a class="mb-3" href="/categories/use-cases">Use Cases</a>
{% set taxonomy = get_taxonomy(kind="categories") %}
{% set categories = taxonomy.items %}
{% for category in categories %}
{% set path = category.name | slugify %}
{% set fullpath = "/categories/" ~ path %}
<a class="mb-3" href={{fullpath}}> {{category.name}} </a>
{% endfor %}
</div>
{% set section = get_section(path="blog/_index.md")%}
<div class="lg:pt-6 flex flex-col mb-12 w-64 mr-24">
<h4 class="text-base not-italic font-medium leading-6 text-gray-600 mb-6"> POPULAR POSTS</h4>
<a class="mb-3 text-blue-700" href="">NEAR Launches Nightshade Sharding, Paving the Way for Mass Adoption</a>
<a class="mb-3" href="/categories/engineering">Engineering</a>
<a class="mb-3" href="/categories/community">Community</a>
<a class="mb-3" href="">Use Cases</a>
<h4 class="text-base not-italic font-medium leading-6 text-gray-600 mb-6"> FEATURED POSTS</h4>
{% for page in section.pages %}
{% if page.extra.isFeatured %}
<a class="mb-3 text-blue-700" href={{page.permalink}}>{{ page.title }}</a>
{% endif %}
{% endfor %}
</div>
</div>

View File

@@ -2,20 +2,22 @@
<div class="relative mt-12 lg:mt-16 lg:grid lg:grid-cols-2 lg:gap-8 lg:items-center">
<div class="relative mx-24">
<h3 class="text-base not-italic leading-6 text-gray-600">FEATURED POST</h3>
<h1 class="text-5xl fw-500 leading-snug font-normal mb-10">
{{ section.title }}
</h1>
<h3 class="text-base not-italic leading-6 text-gray-600">FEATURED POST</h3>
<a href={{featured.permalink}} class="">
<h1 class="text-5xl fw-500 leading-snug font-normal mb-10">
{{ featured.title }}
</h1>
</a>
<h4 class="text-sm not-italic font-light leading-6 text-gray-600">
{{ section.extra.date | date(format="%B %e, %Y", timezone="America/Chicago")}} -
{{ section.extra.author }}
{{ featured.date | date(format="%B %e, %Y", timezone="America/Chicago")}} -
{{ featured.extra.author }}
</h4>
</div>
<div class="mt-10 -mx-4 relative lg:mt-0 max-w-full">
<img class="relative mx-auto max-w-full max-h-80" src=/{{section.extra.imgPath}} alt="" />
<img class="relative mx-auto max-w-full max-h-80" src=/{{featured.extra.imgPath}} alt="" />
</div>
</div>