6 changed files with 311 additions and 122 deletions
@ -1,54 +1,39 @@ |
|||||||
<div> |
<div> |
||||||
{% if list %} |
{% if list %} |
||||||
<div class="featured-cat"> |
{% set _hue = (title|default('x')|length * 47) % 360 %} |
||||||
<small>{{ title }}</small> |
<div |
||||||
</div> |
{{ attributes.defaults({ class: 'featured-list featured-list--wall' }) }} |
||||||
<div {{ attributes }}> |
role="region" |
||||||
<div> |
aria-label="{{ title|e('html_attr') }}" |
||||||
{% set feature = list[0] %} |
> |
||||||
<div class="card"> |
{% for item in list %} |
||||||
<a href="{{ (feature.pubkey and npub_from_hex(feature.pubkey) != '') ? path('article', { npub: npub_from_hex(feature.pubkey), slug: feature.slug }) : path('article-legacy-redirect', { slug: feature.slug }) }}"> |
<article class="featured-tile" style="--tile-hue: {{ _hue }};"> |
||||||
<div class="card-header"> |
<a |
||||||
<img src="{{ article_card_cover(feature.image, feature.pubkey) }}" alt="{{ ('Illustration for ' ~ feature.title)|e('html_attr') }}" width="1200" height="675" loading="lazy" decoding="async"> |
class="featured-tile__link" |
||||||
|
href="{{ (item.pubkey and npub_from_hex(item.pubkey) != '') ? path('article', { npub: npub_from_hex(item.pubkey), slug: item.slug }) : path('article-legacy-redirect', { slug: item.slug }) }}" |
||||||
|
> |
||||||
|
<div class="featured-tile__head"> |
||||||
|
<span class="featured-tile__cat">{{ title }}</span> |
||||||
|
</div> |
||||||
|
<div class="featured-tile__media featured-tile__media--ar{{ loop.index0 % 4 }}"> |
||||||
|
<img |
||||||
|
src="{{ article_card_cover(item.image, item.pubkey) }}" |
||||||
|
alt="{{ ('Illustration for ' ~ item.title)|e('html_attr') }}" |
||||||
|
width="1200" |
||||||
|
height="675" |
||||||
|
loading="lazy" |
||||||
|
decoding="async" |
||||||
|
> |
||||||
</div> |
</div> |
||||||
<div class="card-body"> |
<div class="card-body"> |
||||||
<h2 class="card-title">{{ feature.title }}</h2> |
<h2 class="card-title">{{ item.title }}</h2> |
||||||
{% if feature.displayAt %} |
|
||||||
<p class="featured-list__meta"> |
|
||||||
<time datetime="{{ feature.displayAt|date('c') }}">{{ feature.displayAt|date('F j, Y') }}</time> |
|
||||||
</p> |
|
||||||
{% endif %} |
|
||||||
<p class="lede truncate"> |
<p class="lede truncate"> |
||||||
{{ feature.summary }} |
{{ item.summary }} |
||||||
</p> |
</p> |
||||||
</div> |
</div> |
||||||
</a> |
</a> |
||||||
</div> |
</article> |
||||||
</div> |
{% endfor %} |
||||||
<div> |
|
||||||
{% for item in list %} |
|
||||||
{% if item != feature %} |
|
||||||
<div class="card"> |
|
||||||
<a href="{{ (item.pubkey and npub_from_hex(item.pubkey) != '') ? path('article', { npub: npub_from_hex(item.pubkey), slug: item.slug }) : path('article-legacy-redirect', { slug: item.slug }) }}"> |
|
||||||
<div class="card-header"> |
|
||||||
<img src="{{ article_card_cover(item.image, item.pubkey) }}" alt="{{ ('Illustration for ' ~ item.title)|e('html_attr') }}" width="1200" height="675" loading="lazy" decoding="async"> |
|
||||||
</div> |
|
||||||
<div class="card-body"> |
|
||||||
<h2 class="card-title">{{ item.title }}</h2> |
|
||||||
{% if item.displayAt %} |
|
||||||
<p class="featured-list__meta"> |
|
||||||
<time datetime="{{ item.displayAt|date('c') }}">{{ item.displayAt|date('F j, Y') }}</time> |
|
||||||
</p> |
|
||||||
{% endif %} |
|
||||||
<p class="lede truncate"> |
|
||||||
{{ item.summary }} |
|
||||||
</p> |
|
||||||
</div> |
|
||||||
</a> |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
{% endfor %} |
|
||||||
</div> |
|
||||||
</div> |
</div> |
||||||
{% endif %} |
{% endif %} |
||||||
</div> |
</div> |
||||||
|
|||||||
@ -0,0 +1,41 @@ |
|||||||
|
{# |
||||||
|
Single masonry wall: mixed categories (round-robin), same tile styling as the former per-section list. |
||||||
|
#} |
||||||
|
{% if tiles is not empty %} |
||||||
|
<div |
||||||
|
class="featured-list featured-list--wall" |
||||||
|
role="region" |
||||||
|
aria-label="{{ (website_name ~ ' — featured articles')|e('html_attr') }}" |
||||||
|
> |
||||||
|
{% for tile in tiles %} |
||||||
|
{% set item = tile.article %} |
||||||
|
{% set _hue = (tile.categoryTitle|default('x')|length * 47) % 360 %} |
||||||
|
<article class="featured-tile" style="--tile-hue: {{ _hue }};"> |
||||||
|
<a |
||||||
|
class="featured-tile__link" |
||||||
|
href="{{ (item.pubkey and npub_from_hex(item.pubkey) != '') ? path('article', { npub: npub_from_hex(item.pubkey), slug: item.slug }) : path('article-legacy-redirect', { slug: item.slug }) }}" |
||||||
|
> |
||||||
|
<div class="featured-tile__head"> |
||||||
|
<span class="featured-tile__cat">{{ tile.categoryTitle }}</span> |
||||||
|
</div> |
||||||
|
<div class="featured-tile__media featured-tile__media--ar{{ loop.index0 % 4 }}"> |
||||||
|
<img |
||||||
|
src="{{ article_card_cover(item.image, item.pubkey) }}" |
||||||
|
alt="{{ ('Illustration for ' ~ item.title)|e('html_attr') }}" |
||||||
|
width="1200" |
||||||
|
height="675" |
||||||
|
loading="lazy" |
||||||
|
decoding="async" |
||||||
|
> |
||||||
|
</div> |
||||||
|
<div class="card-body"> |
||||||
|
<h2 class="card-title">{{ item.title }}</h2> |
||||||
|
<p class="lede truncate"> |
||||||
|
{{ item.summary }} |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
</a> |
||||||
|
</article> |
||||||
|
{% endfor %} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
Loading…
Reference in new issue