Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds vertical scrollbar to news #729

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ collections:
output: true
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
Expand Down
12 changes: 9 additions & 3 deletions _includes/news.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
<div class="news">
<h2>news</h2>
{% 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">
{%- assign news = site.news | reverse -%}
{% for item in news limit: site.news_limit %}
{%- assign news = site.news | reverse -%}
{% 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>
<th scope="row">{{ item.date | date: "%b %-d, %Y" }}</th>
<td>
Expand Down