Skip to content

Commit

Permalink
fix: simplify base template
Browse files Browse the repository at this point in the history
  • Loading branch information
chosww committed Jan 6, 2025
1 parent 93d1030 commit b2390bc
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 61 deletions.
16 changes: 16 additions & 0 deletions src/_includes/layouts/about.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{% extends "layouts/base.njk" %}
{% from "partials/components/card.macro.njk" import card %}

{% block content %}
{{ content | safe }}
{% if collections['projects_' + lang] %}
<section class="display">
<div class="display__title">
<h2>Projects</h2>
</div>
<div class="display__items">
{% set cardType = "project" %}
{% for item in collections['projects_' + lang] %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% endblock %}
61 changes: 0 additions & 61 deletions src/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<main>
{% include "partials/global/header.njk" %}
{% include "partials/components/navigation.njk" %}
{% from "partials/components/card.macro.njk" import card %}
{% if hasBanner %}
<div class="banner bg-{{ bannerBgColor }}">
<div class="banner__text">
Expand All @@ -26,66 +25,6 @@
</div>
{% endif %}
{% block content %}{% endblock %}
{% if collections['projects_' + lang] %}
<section class="display">
<div class="display__title">
<h2>Projects</h2>
</div>
<div class="display__items">
{% set cardType = "project" %}
{% for item in collections['projects_' + lang] %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% if collections.events %}
<section class="display">
<div class="display__title">
<h2>Events</h2>
</div>
<div class="display__items">
{% set cardType = "event" %}
{% for item in collections.events %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% if collections.resources %}
<section class="display">
<div class="display__title">
<h2>Resources</h2>
</div>
<div class="display__items">
{% set cardType = "resource" %}
{% for item in collections.resources %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% if collections.news %}
<section class="display">
<div class="display__title">
<h2>Announcements</h2>
</div>
<div class="display__items">
{% set cardType = "news" %}
{% for item in collections.news %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
</main>
{% include "partials/global/footer.njk" %}
</body>
Expand Down
66 changes: 66 additions & 0 deletions src/_includes/layouts/home.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{% extends "layouts/base.njk" %}
{% from "partials/components/card.macro.njk" import card %}

{% block content %}
{{ content | safe }}
{% if collections['projects_' + lang] %}
<section class="display">
<div class="display__title">
<h2>Projects</h2>
</div>
<div class="display__items">
{% set cardType = "project" %}
{% for item in collections['projects_' + lang] %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% if collections.events %}
<section class="display">
<div class="display__title">
<h2>Events</h2>
</div>
<div class="display__items">
{% set cardType = "event" %}
{% for item in collections.events %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% if collections.resources %}
<section class="display">
<div class="display__title">
<h2>Resources</h2>
</div>
<div class="display__items">
{% set cardType = "resource" %}
{% for item in collections.resources %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% if collections.news %}
<section class="display">
<div class="display__title">
<h2>Announcements</h2>
</div>
<div class="display__items">
{% set cardType = "news" %}
{% for item in collections.news %}
{{ card({image: item.data.image, title: item.data.title, body: item.data.body }) }}
{% endfor %}
</div>
<div class="display__link">
</div>
</section>
{% endif %}
{% endblock %}

0 comments on commit b2390bc

Please sign in to comment.