Fixed news limit (#1359)
Fixes #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>
This commit is contained in:
parent
e8c5450790
commit
0b109a23ed
|
|
@ -175,7 +175,7 @@ collections:
|
||||||
output: true
|
output: true
|
||||||
permalink: /projects/:path/
|
permalink: /projects/:path/
|
||||||
|
|
||||||
news:
|
announcements:
|
||||||
enabled: true
|
enabled: true
|
||||||
scrollable: true # adds a vertical scroll bar if there are more than 3 news items
|
scrollable: true # adds a vertical scroll bar if there are more than 3 news items
|
||||||
limit: 5 # leave blank to include all the news in the `_news` folder
|
limit: 5 # leave blank to include all the news in the `_news` folder
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
|
|
||||||
<div class="news">
|
<div class="news">
|
||||||
{% if site.news != blank -%}
|
{% if site.news != blank -%}
|
||||||
{%- assign news_size = site.news | size -%}
|
{%- assign news_size = site.news | size -%}
|
||||||
<div class="table-responsive" {% if site.news.scrollable and news_size > 3 %}style="max-height: 60vw"{% endif %}>
|
<div class="table-responsive" {% if include.limit and site.announcements.scrollable and news_size > 3 %}style="max-height: 60vw"{% endif %}>
|
||||||
<script>console.log({{news_size}});</script>
|
|
||||||
<table class="table table-sm table-borderless">
|
<table class="table table-sm table-borderless">
|
||||||
{%- assign news = site.news | reverse -%}
|
{%- assign news = site.news | reverse -%}
|
||||||
{% if site.news.limit %}
|
{% if include.limit and site.announcements.limit %}
|
||||||
{% assign news_limit = site.news.limit %}
|
{% assign news_limit = site.announcements.limit %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign news_limit = news_size %}
|
{% assign news_limit = news_size %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -28,4 +26,4 @@
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<p>No news so far...</p>
|
<p>No news so far...</p>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -41,9 +41,9 @@ layout: default
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- News -->
|
<!-- News -->
|
||||||
{% if page.news -%}
|
{% if page.news and site.announcements.enabled -%}
|
||||||
<h2><a href="{{ '/news/' | relative_url }}" style="color: inherit;">news</a></h2>
|
<h2><a href="{{ '/news/' | relative_url }}" style="color: inherit;">news</a></h2>
|
||||||
{%- include news.html %}
|
{%- include news.html limit=true %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
<!-- Latest posts -->
|
<!-- Latest posts -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue