diff --git a/sass/home.scss b/sass/home.scss index 80ae724..cb80d08 100644 --- a/sass/home.scss +++ b/sass/home.scss @@ -24,6 +24,27 @@ display: none; } } +.latest-projects-posts { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + gap: 1rem; + margin-top: 5rem; + .project { + display: flex; + flex-direction: column; + margin: 1rem 30%; + gap: 1rem; + .title { + font-size: 1.2rem; + } + .description { + font-size: 1rem; + } + + } +} @media (max-width: 600px) { #pgp { display: none; diff --git a/templates/index.html b/templates/index.html index 00ab939..075b821 100644 --- a/templates/index.html +++ b/templates/index.html @@ -22,5 +22,38 @@ +{# how many items to show #} +{% set n = 6 %} + +{# fetch sections #} +{% set posts = get_section(path="posts/_index.md") %} +{% set projects = get_section(path="projects/_index.md") %} + +{# merge, sort by date (desc), take first n #} +{% set latest = posts.pages + | concat(with=projects.pages) + | sort(attribute="date") + | reverse + | slice(end=n) +%} + +
+

Latest projects & posts

+ {% for page in latest %} +
+ {{ page.title }} +

+ {% if page.description %}{{ page.description }}{% else %}…{% endif %} +

+
+

+ {{ page.date }} + {% if page.path is starting_with("posts/") %} · Post + {% elif page.path is starting_with("projects/") %} · Project + {% endif %} +

+
+ {% endfor %} +
{% endblock content %}