Adds vertical scrollbar to news (#729)
This commit is contained in:
parent
bcd43a18fe
commit
032f0e62ba
|
|
@ -123,7 +123,8 @@ collections:
|
||||||
output: true
|
output: true
|
||||||
permalink: /projects/:path/
|
permalink: /projects/:path/
|
||||||
|
|
||||||
news_limit: 5
|
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
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Jekyll settings
|
# Jekyll settings
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,16 @@
|
||||||
<div class="news">
|
<div class="news">
|
||||||
<h2>news</h2>
|
<h2>news</h2>
|
||||||
{% if site.news != blank -%}
|
{% if site.news != blank -%}
|
||||||
<div class="table-responsive">
|
{%- assign news_size = site.news | size -%}
|
||||||
|
<div class="table-responsive" {% if site.news_scrollable and news_size > 3 %}style="max-height: 10vw"{% endif %}>
|
||||||
<table class="table table-sm table-borderless">
|
<table class="table table-sm table-borderless">
|
||||||
{%- assign news = site.news | reverse -%}
|
{%- assign news = site.news | reverse -%}
|
||||||
{% for item in 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 %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ item.date | date: "%b %-d, %Y" }}</th>
|
<th scope="row">{{ item.date | date: "%b %-d, %Y" }}</th>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue