Skip to content

Commit 97e186a

Browse files
committed
Adjust HTML structure of blog posts
1 parent c60db26 commit 97e186a

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

_includes/post.html

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
<div class="blog__post">
2-
<p>{{ post.date | date: '%B %-d, %Y' }}</p>
3-
4-
<dl>
5-
<dt><a href="{{ post.url }}">{{ post.title | strip_html }}</a></dt>
6-
<dd>{{ post.content | strip_html | truncatewords: 30 }}</dd>
7-
</dl>
8-
</div>
1+
<li class="blog__post">
2+
<div class="post-date">
3+
<p>{{ post.date | date: '%B %-d, %Y' }}</p>
4+
</div>
5+
<div class="post-container">
6+
<h3>
7+
<a href="{{ post.url }}">{{ post.title | strip_html }}</a>
8+
</h3>
9+
<p>
10+
{{ post.content | strip_html | truncatewords: 30 }}
11+
</p>
12+
</div>
13+
</li>

_sass/modules/_blog.scss

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,25 @@
3030

3131
border-top: 3px solid rgba($color-black, 0.1);
3232
padding-top: 30px;
33+
display: flex;
34+
gap: 30px;
3335

34-
p {
36+
37+
38+
.post-date {
39+
flex: 1;
40+
41+
p {
3542
font-size: 21px;
3643
font-weight: 600;
3744
letter-spacing: -0.006em;
3845
line-height: 26px;
3946
margin-top: -7px;
47+
}
4048
}
4149

42-
dl {
43-
50+
.post-container {
51+
flex: 3;
4452
margin-bottom: -6px;
4553
margin-top: 1px;
4654

@@ -62,10 +70,9 @@
6270
}
6371

6472
}
65-
6673
}
6774

68-
dd {
75+
p {
6976

7077
color: $color-grey-5;
7178
font-size: 21px;
@@ -117,12 +124,15 @@
117124
gap: 30px;
118125
padding-top: 40px;
119126

120-
p {
121-
flex: 1;
122-
margin-top: -1px;
127+
.post-date {
128+
p {
129+
flex: 1;
130+
margin-top: -1px;
131+
}
123132
}
124133

125-
dl {
134+
135+
.post-container {
126136
flex: 3;
127137
margin-top: -8px;
128138
}

blog/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ <h1>The Rails Blog: News & Release Notes</h1>
3434

3535
<div class="blog common-padding--bottom">
3636
<div class="container">
37-
<div class="blog__posts">
37+
<ul class="blog__posts">
3838
{% for post in paginator.posts %}
3939
{% include post.html %}
4040
{% endfor %}
41-
</div>
41+
</ul>
4242

4343
{% if paginator.next_page %}
4444
<div class="blog__pagination">

0 commit comments

Comments
 (0)