Skip to content

Commit

Permalink
Implemented latest posts on about page (alshedivat#1307)
Browse files Browse the repository at this point in the history
Adresses alshedivat#340

---------

Signed-off-by: George Araújo <george.gcac@gmail.com>
  • Loading branch information
george-gca authored and hgchen committed Dec 2, 2023
1 parent 1ad486a commit 94d615d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 19 deletions.
19 changes: 15 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,18 @@ twitter_username: # your Twitter handle
linkedin_username: huaijinchen # your LinkedIn user name
scholar_userid: 6E9elWUAAAAJ # your Google Scholar ID
semanticscholar_id: # your Semantic Scholar ID
whatsapp_number: # your WhatsApp number (full phone number in international format. Omit any zeroes, brackets, or dashes when adding the phone number in international format.)
orcid_id: # your ORCID ID
medium_username: # your Medium username
quora_username: # your Quora username
publons_id: # your ID on Publons
osf_id: # your OSF ID
research_gate_profile: # your profile on ResearchGate
blogger_url: # your blogger URL
work_url: # work page URL
keybase_username: # your keybase user name
wikidata_id: # your wikidata id
wikipedia_id: # your wikipedia id (Case sensitive)
dblp_url: # your DBLP profile url
stackoverflow_id: # your stackoverflow id
kaggle_id: # your kaggle id
Expand All @@ -94,6 +97,7 @@ pinterest_id: # your pinterest id
unsplash_id: # your unsplash id
instagram_id: # your instagram id
facebook_id: # your facebook id
youtube_id: # your youtube channel id (youtube.com/@<youtube_id>)
discord_id: # your discord id (18-digit unique numerical identifier)

contact_note: >
Expand Down Expand Up @@ -163,8 +167,15 @@ collections:
output: true
permalink: /projects/:path/

news_scrollable: false # 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
Expand Down Expand Up @@ -374,5 +385,5 @@ mdb:
css: "sha256-jpjYvU3G3N6nrrBwXJoVEYI/0zw8htfFnhT9ljN3JJw="
js: "sha256-NdbiivsvWt7VYCt6hYNT3h/th9vSTL4EDWeGs5SN3DA="
medium_zoom:
version: "1.0.6"
integrity: "sha256-EdPgYcPk/IIrw7FYeuJQexva49pVRZNmt3LculEr7zM="
version: "1.0.8"
integrity: "sha256-7PhEpEWEW0XXQ0k6kQrPKwuoIomz8R8IYyuU1Qew4P8="
26 changes: 26 additions & 0 deletions _includes/latest_posts.html
Original file line number Diff line number Diff line change
@@ -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>
24 changes: 12 additions & 12 deletions _includes/news.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@

<div class="news">
{% if site.news != blank -%}
{% 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 %}
{% for item in news limit: news_limit %}
{% for item in news limit: news_limit %}
<tr>
<th scope="row">{{ item.date | date: "%b %-d, %Y" }}</th>
<td>
{% if item.inline -%}
{% if item.inline -%}
{{ item.content | remove: '<p>' | remove: '</p>' | emojify }}
{%- else -%}
{%- else -%}
<a class="news-title" href="{{ item.url | relative_url }}">{{ item.title }}</a>
{%- endif %}
{%- endif %}
</td>
</tr>
{%- endfor %}
{%- endfor %}
</table>
</div>
{%- else -%}
{%- else -%}
<p>No news so far...</p>
{%- endif %}
{%- endif %}
</div>
12 changes: 9 additions & 3 deletions _layouts/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ <h1 class="post-title">
{%- 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 -%}
Expand All @@ -46,6 +46,12 @@ <h2><a href="{{ '/news/' | relative_url }}" style="color: inherit;">news</a></h2
{%- 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>
Expand All @@ -62,7 +68,7 @@ <h2><a href="{{ '/publications/' | relative_url }}" style="color: inherit;">sele
<div class="contact-note">
{{ site.contact_note }}
</div>

</div>
{%- endif %}
</article>
Expand Down

0 comments on commit 94d615d

Please sign in to comment.