{%- comment -%} ============================================================================ NEWS / MAGAZINE HOMEPAGE
Modeled on the zer0-mistakes news layout but sourced from THIS site's real content. Since issue #337, hacks / tools / field notes / wire dispatches are all one posts collection under pages/_posts/categories (Hacks / Tools / Field Notes / The Wire). The theme's own /news/ landing (layout: news) lives at /news/; this bespoke home just leans on the same data. Card chrome
lives in _includes/home/.
============================================================================
{%- assign all_items = site.posts | sort: 'date' | reverse -%} {%- assign hacks = site.posts | where_exp: "p", "p.categories contains 'Hacks'" | sort: 'date' | reverse -%} {%- assign tools = site.posts | where_exp: "p", "p.categories contains 'Tools'" | sort: 'date' | reverse -%} {%- assign notes = site.posts | where_exp: "p", "p.categories contains 'Field Notes'" | sort: 'date' | reverse -%}
{%- comment -%} Hero = the current Top Story, pointed at by _data/top_story.yml (the weekly-epic routine repoints that file at each new weekly epic; a human can repoint it anywhere). Graceful fallbacks: pointer unset/stale -> the signature story -> newest. {%- endcomment -%} {%- assign hero = site.posts | where_exp: "p", "p.url == site.data.top_story.url" | first -%} {%- unless hero -%}{%- assign hero = site.posts | where_exp: "p", "p.title contains 'Hoard the One That Rots'" | first -%}{%- endunless -%} {%- unless hero -%}{%- assign hero = all_items | first -%}{%- endunless -%} {%- assign rest = all_items | where_exp: "i", "i.url != hero.url" -%} {%- assign main_featured = rest | first -%}
{% if hero %}
{{ hero.title }}
{{ hero.excerpt | default: hero.description | strip_html | truncate: 200 }}
{% endif %}
{% if main_featured %}
Featured
{{ main_featured.title }}
{{ main_featured.excerpt | default: main_featured.description | strip_html | truncate: 150 }}
{% endif %}
{%- assign feed_sections = "hacks,tools,notes,wire" | split: "," -%}
{% for coll in feed_sections %}
{%- case coll -%}
{%- when 'hacks' -%}{%- assign s_label='Hacks' -%}{%- assign s_icon='bi-lightbulb' -%}{%- assign s_url='/news/hacks/' -%}{%- assign s_color='text-primary' -%}{%- assign s_items=hacks -%}
{%- when 'tools' -%}{%- assign s_label='Tools' -%}{%- assign s_icon='bi-wrench-adjustable' -%}{%- assign s_url='/news/tools/' -%}{%- assign s_color='text-info' -%}{%- assign s_items=tools -%}
{%- when 'notes' -%}{%- assign s_label='Field Notes' -%}{%- assign s_icon='bi-journal-text' -%}{%- assign s_url='/news/field-notes/' -%}{%- assign s_color='text-success' -%}{%- assign s_items=notes -%}
{%- when 'wire' -%}{%- assign s_label='The Wire' -%}{%- assign s_icon='bi-broadcast' -%}{%- assign s_url='/news/wire/' -%}{%- assign s_color='text-warning' -%}{%- assign s_items=wire -%}
{%- endcase -%}
{% if s_items.size > 0 %}
{{ s_label }}
View all {{ s_label }}
{% endif %}
Latest
{{ it.title | truncate: 48 }}
{{ it.date | date: "%b %-d" }}Popular Tags
{%- assign all_tags = "" | split: "" -%} {%- for it in all_items -%}{%- for tag in it.tags -%}{%- assign all_tags = all_tags | push: tag -%}{%- endfor -%}{%- endfor -%} {%- assign unique_tags = all_tags | uniq | slice: 0, 15 -%}Archive
{%- assign by_year = all_items | group_by_exp: "it", "it.date | date: '%Y'" -%}{{ year.name }}
{%- assign months = year.items | group_by_exp: "it", "it.date | date: '%B'" -%}-
{% for month in months limit: 6 %}
- {{ month.name }} {{ month.items.size }} {% endfor %}
New dispatches appear here because a robot put them here.
No newsletter, no funnel, no "10x your life" emails. Subscribe by RSS, or watch the robot work in the open on GitHub.