From 28fc70189fbcd167c3e8ae5f97d0c9c0451b92e2 Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:26:48 -0300 Subject: [PATCH] Fixed news limit (#1359) Fixes #1346. --------- Signed-off-by: George Araujo 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> --- _config.yml | 2 +- _includes/news.html | 10 ++++------ _layouts/about.html | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/_config.yml b/_config.yml index b274dd77f867..d82d0617b18e 100644 --- a/_config.yml +++ b/_config.yml @@ -173,7 +173,7 @@ collections: output: true permalink: /projects/:path/ -news: +announcements: enabled: true 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 diff --git a/_includes/news.html b/_includes/news.html index c7fefdcfb111..2146d885e5b4 100644 --- a/_includes/news.html +++ b/_includes/news.html @@ -1,13 +1,11 @@ -
{% if site.news != blank -%} {%- assign news_size = site.news | size -%} -
3 %}style="max-height: 60vw"{% endif %}> - +
3 %}style="max-height: 60vw"{% endif %}> {%- assign news = site.news | reverse -%} - {% if site.news.limit %} - {% assign news_limit = site.news.limit %} + {% if include.limit and site.announcements.limit %} + {% assign news_limit = site.announcements.limit %} {% else %} {% assign news_limit = news_size %} {% endif %} @@ -28,4 +26,4 @@ {%- else -%}

No news so far...

{%- endif %} - + \ No newline at end of file diff --git a/_layouts/about.html b/_layouts/about.html index 8954a2c57930..072ed918fbff 100644 --- a/_layouts/about.html +++ b/_layouts/about.html @@ -41,9 +41,9 @@

- {% if page.news -%} + {% if page.news and site.announcements.enabled -%}

news

- {%- include news.html %} + {%- include news.html limit=true %} {%- endif %}