Skip to content

Commit 0b109a2

Browse files
george-gcaYifanJiang233raffaemLodour
authored
Fixed news limit (alshedivat#1359)
Fixes alshedivat#1346. --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: Yifan Jiang <55911052+YifanJiang233@users.noreply.github.com> Co-authored-by: Raffaele Mancuso <54762742+raffaem@users.noreply.github.com> Co-authored-by: Yue Gao <11145354+Lodour@users.noreply.github.com>
1 parent e8c5450 commit 0b109a2

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ collections:
175175
output: true
176176
permalink: /projects/:path/
177177

178-
news:
178+
announcements:
179179
enabled: true
180180
scrollable: true # adds a vertical scroll bar if there are more than 3 news items
181181
limit: 5 # leave blank to include all the news in the `_news` folder

_includes/news.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
21
<div class="news">
32
{% if site.news != blank -%}
43
{%- assign news_size = site.news | size -%}
5-
<div class="table-responsive" {% if site.news.scrollable and news_size > 3 %}style="max-height: 60vw"{% endif %}>
6-
<script>console.log({{news_size}});</script>
4+
<div class="table-responsive" {% if include.limit and site.announcements.scrollable and news_size > 3 %}style="max-height: 60vw"{% endif %}>
75
<table class="table table-sm table-borderless">
86
{%- assign news = site.news | reverse -%}
9-
{% if site.news.limit %}
10-
{% assign news_limit = site.news.limit %}
7+
{% if include.limit and site.announcements.limit %}
8+
{% assign news_limit = site.announcements.limit %}
119
{% else %}
1210
{% assign news_limit = news_size %}
1311
{% endif %}
@@ -28,4 +26,4 @@
2826
{%- else -%}
2927
<p>No news so far...</p>
3028
{%- endif %}
31-
</div>
29+
</div>

_layouts/about.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ <h1 class="post-title">
4141
</div>
4242

4343
<!-- News -->
44-
{% if page.news -%}
44+
{% if page.news and site.announcements.enabled -%}
4545
<h2><a href="{{ '/news/' | relative_url }}" style="color: inherit;">news</a></h2>
46-
{%- include news.html %}
46+
{%- include news.html limit=true %}
4747
{%- endif %}
4848

4949
<!-- Latest posts -->

0 commit comments

Comments
 (0)