Skip to content

Commit 1911687

Browse files
Add news carousel component for desktop and mobile views (#237)
* Add news carousel component for desktop and mobile views * Reuse blog page components for home page news section * Remove old news carousel styling
1 parent 66c02c8 commit 1911687

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

website/content/index.njk

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ title: MonoGame
1919
</a>
2020
</div>
2121
</div>
22+
2223
<div id="carousel-item-container" class="carousel-inner h-100">
2324
{% for game in games %}
2425
{% if game.tags.includes("Featured") %}
@@ -54,6 +55,35 @@ title: MonoGame
5455
</button>
5556
</section>
5657

58+
<section class="container-xxl mb-5">
59+
<div class="row">
60+
<h3 class="fw-semibold mb-4 text-body-emphasis">Latest News</h3>
61+
</div>
62+
<div class="mg-item-grid">
63+
{% for post in collections.blogPosts | reverse %}
64+
{% if loop.index <= 3 %}
65+
<a class="mg-no-link" href="{{ post.url }}">
66+
<div class="mg-card mg-box-shadow h-100 d-flex flex-column">
67+
<div class="mg-card-thumbnail"
68+
style="background-image: url('{{ post.data.image }}');"
69+
href="{{ post.url }}"></div>
70+
<div class="mg-card-body">
71+
<small>
72+
{{ post.data.author }} -- {{ post.date | readableDate }}
73+
</small>
74+
<div class="mg-card-title">{{ post.data.title }}</div>
75+
<div class="mg-card-excerpt mb-3" title="{{ post.data.excerpt }}">
76+
<p>{{ post.data.excerpt }}</p>
77+
</div>
78+
Click to read more...
79+
</div>
80+
</div>
81+
</a>
82+
{% endif %}
83+
{% endfor %}
84+
</div>
85+
</section>
86+
5787
<section class="container-xxl mb-5">
5888
<div class="row">
5989
<div class="col-12 col-md-6">

website/content/public/css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,4 +868,4 @@ blockquote {
868868

869869
.mg-two-column-list li {
870870
margin-left: 1.5rem; /* Adjusts indentation for list items */
871-
}
871+
}

0 commit comments

Comments
 (0)