Skip to content

Commit 84387dc

Browse files
committed
Adjust HTML structure of blog posts
1 parent c60db26 commit 84387dc

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-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" style="flex:1">
3+
<p>{{ post.date | date: '%B %-d, %Y' }}</p>
4+
</div>
5+
<div class="post-container" style="flex:3">
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: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,22 @@
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+
p {
3540
font-size: 21px;
3641
font-weight: 600;
3742
letter-spacing: -0.006em;
3843
line-height: 26px;
3944
margin-top: -7px;
45+
}
4046
}
4147

42-
dl {
43-
48+
.post-container {
4449
margin-bottom: -6px;
4550
margin-top: 1px;
4651

@@ -62,10 +67,9 @@
6267
}
6368

6469
}
65-
6670
}
6771

68-
dd {
72+
p {
6973

7074
color: $color-grey-5;
7175
font-size: 21px;
@@ -117,12 +121,15 @@
117121
gap: 30px;
118122
padding-top: 40px;
119123

120-
p {
121-
flex: 1;
122-
margin-top: -1px;
124+
.post-date {
125+
p {
126+
flex: 1;
127+
margin-top: -1px;
128+
}
123129
}
124130

125-
dl {
131+
132+
.post-container {
126133
flex: 3;
127134
margin-top: -8px;
128135
}

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)