Skip to content

Commit 42bac9c

Browse files
committed
feat(index): minimalize homepage styling of news
1 parent 29fb2fe commit 42bac9c

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ date_format = "%F"
1212
[extra.home]
1313
max_posts = 3
1414
show_summaries = false
15+
max_summary_length = 250
1516

1617
[extra.social_links]
1718
twitter = "rust_gamedev"

sass/_extra.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,11 @@ h6:hover .anchor {
6868
padding: 8px;
6969
border: 1px solid #e8e8e8;
7070
}
71+
72+
.post-link {
73+
display: inline-block;
74+
}
75+
76+
.post-list li h3 {
77+
margin-bottom: 0;
78+
}

templates/includes/home.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,21 @@ <h2 class="post-list-heading">{{ section.title | default(value="Latest News") }}
3131
<ul class="post-list">
3232
{% for post in posts.pages | slice(end=config.extra.home.max_posts) %}
3333
<li>
34-
{% if post.date %}
35-
{% set date_format = config.extra.date_format | default(value="%b %-d, %Y") %}
36-
<span class="post-meta">{{ post.date | date(format=date_format) }}</span>
37-
{% endif %}
38-
3934
<h3>
4035
<a class="post-link" href="{{ post.permalink }}">
4136
{{ post.title }}
4237
</a>
4338
</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 %}
4443

45-
{% if config.extra.show_summaries %}
46-
{{ page.summary | default(value=page.content | safe | striptags | trim | truncate(length=100)) }}
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>
4749
{% endif %}
4850
</li>
4951
{% endfor %}

0 commit comments

Comments
 (0)