Skip to content

Commit

Permalink
Merge pull request #610 from oddbird/feature-layout
Browse files Browse the repository at this point in the history
Add featured workshop to home & css/_talk/oss pages
  • Loading branch information
jgerigmeyer committed May 31, 2024
2 parents 9f27f4d + 8bfab18 commit ff84363
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 20 deletions.
10 changes: 10 additions & 0 deletions content/_includes/page/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
</div>
{%- endif %}

{%- set show_workshop = feature_workshop or (tags and (('CSS' in tags) or ('_talk' in tags))) or oss -%}
{%- set fw = collections._talk | findPage('data.feature', 'workshop') -%}
{%- set is_workshop = page.url == fw.url -%}
{%- if fw and show_workshop and not is_workshop -%}
<section data-typeset>
{% import "page/workshop.macros.njk" as workshop %}
{{ workshop.feature(fw) }}
</section>
{%- endif -%}

{% include 'page/mentions.njk' %}

{% if oss or sponsors %}
Expand Down
26 changes: 26 additions & 0 deletions content/_includes/page/workshop.macros.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% import 'utility.macros.njk' as utility %}
{% import 'layout.macros.njk' as layout %}
{% import 'post.macros.njk' as post %}

{% macro feature(page) %}
{{ layout.title('Upcoming Workshop') }}
<article {{ post.aria_label(page) }} class="feature-workshop">
{{ post.hero(page.data.image, 'post') }}
<header class="training-header">
{{ post.banner(page) }}
{{ post.subtitle(page.data.sub) }}
{{ post.byline(page, collections) }}
</header>

<div class="training-detail">
{{ page.data.summary | md | safe }}

{% if page.data.action %}
{{ utility.main_action(
page.data.action.text,
url=page.data.action.url
) }}
{% endif %}
</div>
</article>
{% endmacro %}
6 changes: 6 additions & 0 deletions content/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ tools:
{{ embed.logos(work, collections.all) }}
{{ layout.section_link('View work samples', '/work/') }}

{% set fw = collections._talk | findPage('data.feature', 'workshop') %}
{% if fw %}
{% import "page/workshop.macros.njk" as workshop %}
{{ workshop.feature(fw) }}
{% endif %}

{{ post.homepage_posts(
collections,
class='preview'
Expand Down
1 change: 1 addition & 0 deletions content/services/index.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
feature_workshop: true
title: Services
banner: OddBird's Services
services:
Expand Down
22 changes: 2 additions & 20 deletions content/talks.njk
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,8 @@ summary: |

{% set fw = collections._talk | findPage('data.feature', 'workshop') %}
{% if fw %}
{{ layout.title('Upcoming Workshop') }}
<article {{ post.aria_label(item) }} class="feature-workshop">
{{ post.hero(fw.data.image, 'post') }}
<header class="training-header">
{{ post.banner(fw) }}
{{ post.subtitle(fw.data.sub) }}
{{ post.byline(fw, collections) }}
</header>

<div class="training-detail">
{{ fw.data.summary | md | safe }}

{% if fw.data.action %}
{{ utility.main_action(
fw.data.action.text,
url=fw.data.action.url
) }}
{% endif %}
</div>
</article>
{% import "page/workshop.macros.njk" as workshop %}
{{ workshop.feature(fw) }}
{% endif %}

{{ quotes.find(
Expand Down

0 comments on commit ff84363

Please sign in to comment.