Implemented latest posts on about page (#1307)
Adresses #340 --------- Signed-off-by: George Araújo <george.gcac@gmail.com>
This commit is contained in:
parent
5ff54a74ef
commit
60209cfd93
11
_config.yml
11
_config.yml
|
|
@ -174,8 +174,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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
<div class="news">
|
||||
{% if site.latest_posts != blank -%}
|
||||
{%- assign latest_posts_size = site.posts | size -%}
|
||||
<div class="table-responsive" {% if site.latest_posts.scrollable and latest_posts_size > 3 %}style="max-height: 10vw"{% endif %}>
|
||||
<table class="table table-sm table-borderless">
|
||||
{%- 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 %}
|
||||
<tr>
|
||||
<th scope="row">{{ item.date | date: "%b %-d, %Y" }}</th>
|
||||
<td>
|
||||
<a class="news-title" href="{{ item.url | relative_url }}">{{ item.title }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{%- else -%}
|
||||
<p>No posts so far...</p>
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
<div class="news">
|
||||
{% if site.news != blank -%}
|
||||
{%- assign news_size = site.news | size -%}
|
||||
<div class="table-responsive" {% if site.news_scrollable and news_size > 3 %}style="max-height: 10vw"{% endif %}>
|
||||
<div class="table-responsive" {% if site.news.scrollable and news_size > 3 %}style="max-height: 10vw"{% endif %}>
|
||||
<table class="table table-sm table-borderless">
|
||||
{%- 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 %}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ layout: default
|
|||
{%- include news.html %}
|
||||
{%- endif %}
|
||||
|
||||
<!-- Latest posts -->
|
||||
{% if page.latest_posts -%}
|
||||
<h2><a href="{{ '/blog/' | relative_url }}" style="color: inherit;">latest posts</a></h2>
|
||||
{%- include latest_posts.html %}
|
||||
{%- endif %}
|
||||
|
||||
<!-- Selected papers -->
|
||||
{% if page.selected_papers -%}
|
||||
<h2><a href="{{ '/publications/' | relative_url }}" style="color: inherit;">selected publications</a></h2>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ profile:
|
|||
<p>Your City, State 12345</p>
|
||||
|
||||
news: true # 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
|
||||
---
|
||||
|
|
|
|||
Loading…
Reference in New Issue