diff --git a/conf/netlify/cms/config.yml b/conf/netlify/cms/config.yml index 2cc7a80e..5ab79c16 100644 --- a/conf/netlify/cms/config.yml +++ b/conf/netlify/cms/config.yml @@ -219,9 +219,10 @@ collections: widget: markdown, buttons: [bold, italic, link], editor_components: [], minimal: true} - label: "News" name: "news" + hint: "Posts added here will be displayed instead of the latest news" widget: "list" i18n: true - max: 3 + max: 4 types: - label: "Editorial" name: "editorial" diff --git a/src/site/_layouts/home.html b/src/site/_layouts/home.html index 06ba3834..4263bafa 100644 --- a/src/site/_layouts/home.html +++ b/src/site/_layouts/home.html @@ -48,9 +48,33 @@

{% inlineMarkdown paragraph.title %}

{% if news | length %}
-

{% inlineMarkdown news_title %}

enabled to see +

{% inlineMarkdown news_title %}

+
+ {% set latest_news = collections.blogPosts[locale].latest %} + {% set max_latest = latest_news.length - news.length %} + {% set latest_count = 0 %} + {% for post in latest_news %} + {% if latest_count < max_latest %} + {% set display = true %} + {% for chosen in news %} + {% set display = display and chosen.post != post.data.id %} + {% endfor %} + {% if display %} + {% set latest_count = latest_count + 1 %} + + {% inlineMarkdown post.data| getLocalizedOrDefault("image_caption") %} +

{% inlineMarkdown post.data.title %}

+ {% markdown post.data.lead %} + +
+ {% endif %} + {% endif %} + {% endfor %} {% for item in news %} {% for post in collections[item.type] %} {% if post.data.locale == locale and post.data.id == item.post %}