Skip to content

Commit 0d0f55a

Browse files
committed
Improved blog section display
1 parent 1f1120f commit 0d0f55a

2 files changed

Lines changed: 105 additions & 5 deletions

File tree

content/blog.ejs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,26 @@ This section has articles that share development details and progress about Cera
3333

3434
<% for (aMenu of articleMenus) { %>
3535
<h2><%= aMenu %></h2>
36-
<ul>
36+
<div class="blog-cards">
3737
<%
3838
for (item of allArticles) {
3939
if (item.data.category == 'blog' && item.url != '/blog/' && item.data.menu == aMenu) {
4040
%>
41-
<li>
42-
<span class="item-date"><%= item.date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %></span> <a href="<%= item.url %>"><%= item.data.title %></a>
43-
</li>
41+
<a href="<%= item.url %>" class="blog-card">
42+
<div class="blog-card-image">
43+
<img src="<%= item.data.image %>" alt="<%= item.data.title %>" />
44+
</div>
45+
<div class="blog-card-content">
46+
<div class="blog-card-date"><%= item.date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) %></div>
47+
<div class="blog-card-title"><%= item.data.title %></div>
48+
<% if (item.data.description) { %>
49+
<div class="blog-card-description"><%= item.data.description %></div>
50+
<% } %>
51+
</div>
52+
</a>
4453
<%
4554
}
4655
}
4756
%>
48-
</ul>
57+
</div>
4958
<% } %>

content/static/style.css

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,97 @@ body#page-examples.page-examples-index {
10421042
color: #7fc4ff !important;
10431043
}
10441044

1045+
/* Blog Cards */
1046+
.blog-cards {
1047+
display: flex;
1048+
flex-direction: column;
1049+
gap: 16px;
1050+
margin-bottom: 30px;
1051+
}
1052+
1053+
.blog-card {
1054+
display: flex;
1055+
flex-direction: row;
1056+
background-color: #252525;
1057+
border: 1px solid #404040;
1058+
text-decoration: none;
1059+
transition: background-color 0.15s, border-color 0.15s;
1060+
overflow: hidden;
1061+
}
1062+
1063+
.blog-card:hover {
1064+
background-color: #303030;
1065+
border-color: #505050;
1066+
}
1067+
1068+
.blog-card,
1069+
.blog-card:hover,
1070+
.blog-card *,
1071+
.blog-card:hover * {
1072+
text-decoration: none !important;
1073+
}
1074+
1075+
.blog-card-image {
1076+
flex-shrink: 0;
1077+
width: 200px;
1078+
min-height: 150px;
1079+
overflow: hidden;
1080+
background-color: #111;
1081+
position: relative;
1082+
}
1083+
1084+
.blog-card-image img {
1085+
position: absolute;
1086+
top: 0;
1087+
left: 0;
1088+
width: 100%;
1089+
height: 100%;
1090+
object-fit: cover;
1091+
object-position: center;
1092+
}
1093+
1094+
.blog-card-content {
1095+
flex: 1;
1096+
padding: 16px;
1097+
display: flex;
1098+
flex-direction: column;
1099+
justify-content: center;
1100+
}
1101+
1102+
.blog-card-date {
1103+
font-size: 13px;
1104+
color: #888;
1105+
margin-bottom: 6px;
1106+
}
1107+
1108+
.blog-card-title {
1109+
font-size: 18px;
1110+
font-weight: bold;
1111+
color: #60AFEF;
1112+
margin-bottom: 8px;
1113+
}
1114+
1115+
.blog-card:hover .blog-card-title {
1116+
color: #7fc4ff;
1117+
}
1118+
1119+
.blog-card-description {
1120+
font-size: 14px;
1121+
color: #999;
1122+
line-height: 1.4;
1123+
}
1124+
1125+
@media (max-width: 500px) {
1126+
.blog-card {
1127+
flex-direction: column;
1128+
}
1129+
1130+
.blog-card-image {
1131+
width: 100%;
1132+
height: 180px;
1133+
}
1134+
}
1135+
10451136
@media (max-width: 600px) {
10461137
#page-guides.page-guides-index .content-right {
10471138
width: 100%;

0 commit comments

Comments
 (0)