From cae88a58a9df8dcbd892df927e869f0441172199 Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:19:08 -0300 Subject: [PATCH] Implemented latest posts on about page (#1307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adresses #340 --------- Signed-off-by: George Araújo --- _config.yml | 11 +++++++++-- _includes/latest_posts.html | 26 ++++++++++++++++++++++++++ _includes/news.html | 24 ++++++++++++------------ _layouts/about.html | 12 +++++++++--- _pages/about.md | 1 + 5 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 _includes/latest_posts.html diff --git a/_config.yml b/_config.yml index 809caeeffee2..752bb23c85db 100644 --- a/_config.yml +++ b/_config.yml @@ -173,8 +173,15 @@ collections: output: true permalink: /projects/:path/ -news_scrollable: true # adds a vertical scroll bar if there are more than 3 news items -news_limit: 5 # leave blank to include all the news in the `_news` folder +news: + 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 + +latest_posts: + enabled: true + scrollable: true # adds a vertical scroll bar if there are more than 3 new posts items + limit: 3 # leave blank to include all the blog posts # ----------------------------------------------------------------------------- # Jekyll settings diff --git a/_includes/latest_posts.html b/_includes/latest_posts.html new file mode 100644 index 000000000000..c9fb643c9d07 --- /dev/null +++ b/_includes/latest_posts.html @@ -0,0 +1,26 @@ + +
+ {% if site.latest_posts != blank -%} + {%- assign latest_posts_size = site.posts | size -%} +
3 %}style="max-height: 10vw"{% endif %}> + + {%- assign latest_posts = site.posts -%} + {% if site.latest_posts.limit %} + {% assign latest_posts_limit = site.latest_posts.limit %} + {% else %} + {% assign latest_posts_limit = latest_posts_size %} + {% endif %} + {% for item in latest_posts limit: latest_posts_limit %} + + + + + {%- endfor %} +
{{ item.date | date: "%b %-d, %Y" }} + {{ item.title }} +
+
+ {%- else -%} +

No posts so far...

+ {%- endif %} +
diff --git a/_includes/news.html b/_includes/news.html index 14d286daa7f2..963485d89caa 100644 --- a/_includes/news.html +++ b/_includes/news.html @@ -1,30 +1,30 @@ - +
- {% if site.news != blank -%} + {% if site.news != blank -%} {%- assign news_size = site.news | size -%} -
3 %}style="max-height: 10vw"{% endif %}> +
3 %}style="max-height: 10vw"{% endif %}> {%- assign news = site.news | reverse -%} - {% if site.news_limit %} - {% assign news_limit = site.news_limit %} + {% if site.news.limit %} + {% assign news_limit = site.news.limit %} {% else %} {% assign news_limit = news_size %} {% endif %} - {% for item in news limit: news_limit %} + {% for item in news limit: news_limit %} - {%- endfor %} + {%- endfor %}
{{ item.date | date: "%b %-d, %Y" }} - {% if item.inline -%} + {% if item.inline -%} {{ item.content | remove: '

' | remove: '

' | emojify }} - {%- else -%} + {%- else -%} {{ item.title }} - {%- endif %} + {%- endif %}
- {%- else -%} + {%- else -%}

No news so far...

- {%- endif %} + {%- endif %}
diff --git a/_layouts/about.html b/_layouts/about.html index ab6674a90083..8954a2c57930 100644 --- a/_layouts/about.html +++ b/_layouts/about.html @@ -23,8 +23,8 @@

{%- assign profile_image_class = "img-fluid z-depth-1 rounded" -%} {% endif %} - {% include figure.html - path=profile_image_path + {% include figure.html + path=profile_image_path class=profile_image_class alt=page.profile.image -%} {% endif -%} @@ -46,6 +46,12 @@

news

+ {% if page.latest_posts -%} +

latest posts

+ {%- include latest_posts.html %} + {%- endif %} + {% if page.selected_papers -%}

selected publications

@@ -62,7 +68,7 @@

sele
{{ site.contact_note }}
- +

{%- endif %} diff --git a/_pages/about.md b/_pages/about.md index 4126a800f937..e0407f2c30e6 100644 --- a/_pages/about.md +++ b/_pages/about.md @@ -11,6 +11,7 @@ profile: address: news: false # includes a list of news items +latest_posts: true # includes a list of the newest posts selected_papers: true # includes a list of papers marked as "selected={true}" social: true # includes social icons at the bottom of the page ---