{%- 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/

/, distinguished by 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 -%}

{{ site.title }}

{{ site.subtitle }}

{% if hero %}

Top Story

{{ hero.title }}

{{ hero.excerpt | default: hero.description | strip_html | truncate: 200 }}

{{ hero.date | date: "%B %-d, %Y" }} {%- assign hero_author = site.data.authors[hero.author] -%} {% if hero_author %}{{ hero_author.name }}{% endif %} {% if hero.categories.size > 0 %}{{ hero.categories | first }}{% endif %}
Read the full story
{%- comment -%} The hero wears its own cover art (theme convention: a `preview:` may omit the /assets prefix — same normalization as home/cover.html), falling back to the site banner when the story has none. {%- endcomment -%} {%- assign hero_img = site.og_image -%} {%- if hero.preview and hero.preview != '' -%} {%- assign hero_img = hero.preview -%} {%- unless hero_img contains '://' or hero_img contains '/assets' -%}{%- assign hero_img = '/assets' | append: hero_img -%}{%- endunless -%} {%- endif -%} {{ hero.title }}

{% endif %}

{%- assign nav_sections = "hacks,tools,notes,wire,docs,about" | split: "," -%} {% for coll in nav_sections %} {%- case coll -%} {%- when 'hacks' -%}{%- assign n_label='Hacks' -%}{%- assign n_icon='bi-lightbulb' -%}{%- assign n_url='/news/hacks/' -%}{%- assign n_count=hacks.size -%} {%- when 'tools' -%}{%- assign n_label='Tools' -%}{%- assign n_icon='bi-wrench-adjustable' -%}{%- assign n_url='/news/tools/' -%}{%- assign n_count=tools.size -%} {%- when 'notes' -%}{%- assign n_label='Field Notes' -%}{%- assign n_icon='bi-journal-text' -%}{%- assign n_url='/news/field-notes/' -%}{%- assign n_count=notes.size -%} {%- when 'wire' -%}{%- assign n_label='The Wire' -%}{%- assign n_icon='bi-broadcast' -%}{%- assign n_url='/news/wire/' -%}{%- assign n_count=wire.size -%} {%- when 'docs' -%}{%- assign n_label='Docs' -%}{%- assign n_icon='bi-robot' -%}{%- assign n_url='/docs/' -%}{%- assign n_count=site.docs.size -%} {%- when 'about' -%}{%- assign n_label='About' -%}{%- assign n_icon='bi-info-circle' -%}{%- assign n_url='/about/' -%}{%- assign n_count=site.about.size -%} {%- endcase -%} {% endfor %}

{% if main_featured %}

Featured

{% include home/cover.html collection=main_featured.collection height='300px' preview=main_featured.preview alt=main_featured.title %}
Editor's pick

{{ main_featured.title }}

{{ main_featured.excerpt | default: main_featured.description | strip_html | truncate: 150 }}

{% for fp in secondary limit: 4 %}
{% include home/card.html item=fp cover_height='120px' %}
{% endfor %}

{% 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 %}

{% for it in s_items limit: 4 %}
{% include home/card.html item=it cover_height='150px' %}
{% endfor %}

{% endif %}

Latest

{% for it in all_items limit: 6 %} {%- assign l_cat = it.categories | first -%} {%- case l_cat -%} {%- when 'Hacks' -%}{%- assign l_label='Hack' -%}{%- assign l_badge='text-bg-primary' -%}{%- assign l_section='hacks' -%} {%- when 'Tools' -%}{%- assign l_label='Tool' -%}{%- assign l_badge='text-bg-info' -%}{%- assign l_section='tools' -%} {%- when 'Field Notes' -%}{%- assign l_label='Field Note' -%}{%- assign l_badge='text-bg-success' -%}{%- assign l_section='posts' -%} {%- when 'The Wire' -%}{%- assign l_label='Dispatch' -%}{%- assign l_badge='text-bg-warning' -%}{%- assign l_section='wire' -%} {%- else -%}{%- assign l_label=l_cat | default: 'Post' -%}{%- assign l_badge='text-bg-secondary' -%}{%- assign l_section='posts' -%} {%- endcase -%}
{% include home/cover.html collection=l_section height='110px' class='h-100' preview=it.preview alt=it.title %}
{{ l_label }}

{{ it.title | truncate: 48 }}

{{ it.date | date: "%b %-d" }}
{% endfor %}

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 -%}
{% for tag in unique_tags %} {{ tag }} {% endfor %}
Browse all tags

Archive

{%- assign by_year = all_items | group_by_exp: "it", "it.date | date: '%Y'" -%}
{% for year in by_year limit: 2 %}

{{ year.name }}

{%- assign months = year.items | group_by_exp: "it", "it.date | date: '%B'" -%}
{% endfor %}
Browse the archive

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.