Skip to content

Commit b71e841

Browse files
committed
feat(blog): add overview page that lists all posts
1 parent 42bac9c commit b71e841

File tree

18 files changed

+89
-30
lines changed

18 files changed

+89
-30
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ This project is licensed under either of:
3131
With the exception of:
3232

3333
* The [Font Awesome](https://fontawesome.com) social icons, which are used under a [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) license
34-
* The [OpenMoji](https://openmoji.org) icons used on the homepage, which are used under a [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/) license
34+
* The [OpenMoji](https://openmoji.org) icons used on the homepage, which are used under a [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/) license

config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ date_format = "%F"
1111

1212
[extra.home]
1313
max_posts = 3
14+
15+
[extra.posts]
1416
show_summaries = false
1517
max_summary_length = 250
1618

content/posts/_index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
2-
redirect_to = "/"
2+
title = "Posts"
33
insert_anchor_links = "right"
4+
template = "posts.html"
45
page_template = "post.html"
56
sort_by = "date"
6-
+++
7+
+++

content/posts/newsletter-001/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #1 - August 2019"
33
date = 2019-09-02
4+
transparent = true
45
aliases = ["/2019/09/02/newsletter-001", "2019/09/02/newsletter-001.html"]
56
+++
67

content/posts/newsletter-002/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #2 - September 2019"
33
date = 2019-10-05
4+
transparent = true
45
aliases = ["/2019/10/05/newsletter-002", "2019/10/05/newsletter-002.html"]
56
+++
67

content/posts/newsletter-003/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #3 - October 2019"
33
date = 2019-11-07
4+
transparent = true
45
aliases = ["/2019/11/027/newsletter-003", "2019/11/07/newsletter-003.html"]
56
+++
67

content/posts/newsletter-004/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #4 - November 2019"
33
date = 2019-12-08
4+
transparent = true
45
+++
56

67
<!-- markdownlint-disable no-trailing-punctuation -->

content/posts/newsletter-005/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #5 - December 2019"
33
date = 2020-01-10
4+
transparent = true
45
+++
56

67
Welcome to the fifth issue of the Rust GameDev Workgroup’s

content/posts/newsletter-006/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #6 - January 2020"
33
date = 2020-02-16
4+
transparent = true
45
+++
56

67
<!-- markdownlint-disable no-trailing-punctuation -->

content/posts/newsletter-007/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #7 - February 2020"
33
date = 2020-03-05
4+
transparent = true
45
+++
56

67
<!-- markdownlint-disable no-trailing-punctuation -->

content/posts/newsletter-008/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "This Month in Rust GameDev #8 - March 2020"
33
date = 2020-04-08
4+
transparent = true
45
+++
56

67
<!-- markdownlint-disable no-trailing-punctuation -->

content/posts/survey-01/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
+++
22
title = "Rust Game Development - Ecosystem Survey"
33
date = 2020-02-06
4+
transparent = true
45
+++
56

67
In August last year, we conducted a survey for the Rust gamedev ecosystem. After an unfortunate delay, we can finally present the results. We received a whopping 403 responses! This trove of valuable feedback will inform the WG's roadmap for 2020.

newsletter-template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
+++
22
title = "This Month in Rust GameDev #{TODO} - {TODO} {TODO}"
3+
transparent = true
34
draft = true
45
+++
56

sass/_extra.scss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ li {
99

1010
.intro {
1111
color: #ffffff;
12-
background-color: #0074D9;
12+
background-color: $brand-color;
1313
margin-top: -30px;
1414
padding: 32px 0;
1515
border-bottom: 1px solid #e8e8e8;
@@ -76,3 +76,22 @@ h6:hover .anchor {
7676
.post-list li h3 {
7777
margin-bottom: 0;
7878
}
79+
80+
a.btn {
81+
text-decoration: none;
82+
border-radius: 3px;
83+
font-weight: 600;
84+
border: 1px solid transparent;
85+
box-sizing: border-box;
86+
display: inline-block;
87+
padding: 0.4em 2em;
88+
89+
background-color: $brand-color;
90+
color: $background-color;
91+
border-color: $background-color;
92+
93+
&:hover {
94+
color: lighten($background-color, 10);
95+
border-color: $brand-color;
96+
}
97+
}

templates/includes/home.html

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,15 @@
2727
<h2 class="post-list-heading">{{ section.title | default(value="Latest News") }}</h2>
2828

2929
{% set posts = get_section(path="posts/_index.md") %}
30-
{% if posts and posts.pages | length > 0 %}
31-
<ul class="post-list">
32-
{% for post in posts.pages | slice(end=config.extra.home.max_posts) %}
33-
<li>
34-
<h3>
35-
<a class="post-link" href="{{ post.permalink }}">
36-
{{ post.title }}
37-
</a>
38-
</h3>
39-
{% if post.date %}
40-
{% set date_format = config.extra.date_format | default(value="%b %-d, %Y") %}
41-
<span class="post-meta">{{ post.date | date(format=date_format) }}</span>
42-
{% endif %}
43-
44-
{% if config.extra.home.show_summaries %}
45-
{% set max_length = config.extra.home.max_summary_length %}
46-
<p>
47-
{{ post.description | default(value=post.content | safe | striptags | trim | truncate(length=max_length)) }}
48-
</p>
49-
{% endif %}
50-
</li>
51-
{% endfor %}
52-
</ul>
53-
{% else %}
54-
<p class="grey">None yet - stay tuned for updates and announcements!</p>
55-
{% endif %}
30+
{% set pages = posts.pages | slice(end=config.extra.home.max_posts) %}
31+
{{ macros::post_list(posts=pages, placeholder="None yet - stay tuned for updates and announcements!") }}
5632

5733
<p class="feed-subscribe">
34+
{% if pages | length > 0 %}
35+
<a class="btn" id="all-news" href="{{ get_url(path='posts/') }}">
36+
All News
37+
</a>
38+
{% endif %}
5839
<a href="{{ get_url(path='rss.xml') }}">
5940
<svg class="svg-icon orange"><use xlink:href="{{ get_url(path='minima-social-icons.svg#rss') }}"></use></svg><span>Subscribe</span>
6041
</a>

templates/includes/post_list.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{% macro post_list(posts, placeholder) %}
2+
{% if posts | length > 0 %}
3+
<ul class="post-list">
4+
{% for post in posts %}
5+
<li>
6+
<h3>
7+
<a class="post-link" href="{{ post.permalink }}">
8+
{{ post.title }}
9+
</a>
10+
</h3>
11+
{% if post.date %}
12+
{% set date_format = config.extra.date_format | default(value="%b %-d, %Y") %}
13+
<span class="post-meta">{{ post.date | date(format=date_format) }}</span>
14+
{% endif %}
15+
16+
{% if config.extra.posts.show_summaries %}
17+
{% set max_length = config.extra.posts.max_summary_length %}
18+
<p>
19+
{{ post.description | default(value=post.content | striptags | trim | truncate(length=max_length) | safe) }}
20+
</p>
21+
{% endif %}
22+
</li>
23+
{% endfor %}
24+
</ul>
25+
{% else %}
26+
<p class="grey">{{ placeholder }}</p>
27+
{% endif %}
28+
{% endmacro post_list %}

templates/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% import "includes/post_list.html" as macros %}
12
<!DOCTYPE html>
23
<html lang="{% block lang_decl %}{{ config.default_language }}{% endblock lang_decl %}">
34

templates/posts.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends "index.html" %}
2+
3+
{% block lang_decl %}{{ lang }}{% endblock lang_decl %}
4+
5+
{% block content %}
6+
<div class="posts wrapper">
7+
<h2 class="post-list-heading">{{ section.title | default(value="Latest News") }}</h2>
8+
9+
{{ macros::post_list(posts=section.pages, placeholder="None yet - stay tuned for updates and announcements!") }}
10+
11+
<p class="feed-subscribe">
12+
<a href="{{ get_url(path='rss.xml') }}">
13+
<svg class="svg-icon orange"><use xlink:href="{{ get_url(path='minima-social-icons.svg#rss') }}"></use></svg><span>Subscribe</span>
14+
</a>
15+
</p>
16+
</div>
17+
{% endblock content %}

0 commit comments

Comments
 (0)