Categories for projects and an optional horizontal project card style (#224)

* Add webpage to academic pages list

* adding panelbear analytics

* added categories for projects and horizontal mode display for projects

* rewrote the code to ensure it works properly with current project definitions

* Style adjustments

Co-authored-by: Maruan Al-Shedivat <alshedivat.maruan@gmail.com>
This commit is contained in:
Dinesh Natesan 2021-04-12 00:04:15 +05:30 committed by GitHub
parent 0e4df831af
commit e27fe2a021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 178 additions and 53 deletions

View File

@ -166,13 +166,17 @@ scholar:
# Optional Features
# -----------------------------------------------------------------------------
enable_google_analytics: false
enable_panelbear_analytics: false
enable_mansory: true
enable_math: true
enable_tooltips: false
enable_darkmode: true
enable_navbar_social: false
enable_google_analytics: false # enables google analytics
enable_panelbear_analytics: false # enables panelbear analytics
enable_mansory: true # enables automatic project cards arangement
enable_math: true # enables math typesetting (uses MathJax)
enable_tooltips: false # enables automatic tooltip links generated
# for each section titles on pages and posts
enable_darkmode: true # enables switching between light/dark modes
enable_navbar_social: false # enables displaying social links in the
# navbar on the about page
enable_project_categories: true # enables categorization of projects into
# multiple categories
# -----------------------------------------------------------------------------
# Library versions

32
_includes/projects.html Normal file
View File

@ -0,0 +1,32 @@
<div class="grid-item">
{% if project.redirect %}
<a href="{{ project.redirect }}" target="_blank">
{% else %}
<a href="{{ project.url | relative_url }}">
{% endif %}
<div class="card hoverable">
{% if project.img %}
<img src="{{ project.img | relative_url }}" alt="project thumbnail">
{% endif %}
<div class="card-body">
<h2 class="card-title text-lowercase">{{ project.title }}</h2>
<p class="card-text">{{ project.description }}</p>
<div class="row ml-1 mr-1 p-0">
{% if project.github %}
<div class="github-icon">
<div class="icon" data-toggle="tooltip" title="Code Repository">
<a href="{{ project.github }}" target="_blank"><i class="fab fa-github gh-icon"></i></a>
</div>
{% if project.github_stars %}
<span class="stars" data-toggle="tooltip" title="GitHub Stars">
<i class="fas fa-star"></i>
<span id="{{ project.github_stars }}-stars"></span>
</span>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
</a>
</div>

View File

@ -0,0 +1,40 @@
<div class="card-item col">
{% if project.redirect %}
<a href="{{ project.redirect }}" target="_blank">
{% else %}
<a href="{{ project.url | relative_url }}">
{% endif %}
<div class="card hoverable">
<div class="row g-0">
{% if project.img %}
<div class="card-img col-md-6">
<img src="{{ project.img | relative_url }}" alt="project thumbnail">
</div>
<div class="col-md-6">
{% else %}
<div class="col-md-12">
{% endif %}
<div class="card-body">
<h3 class="card-title text-lowercase">{{ project.title }}</h3>
<p class="card-text">{{ project.description }}</p>
<div class="row ml-1 mr-1 p-0">
{% if project.github %}
<div class="github-icon">
<div class="icon" data-toggle="tooltip" title="Code Repository">
<a href="{{ project.github }}" target="_blank"><i class="fab fa-github gh-icon"></i></a>
</div>
{% if project.github_stars %}
<span class="stars" data-toggle="tooltip" title="GitHub Stars">
<i class="fas fa-star"></i>
<span id="{{ project.github_stars }}-stars"></span>
</span>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</a>
</div>

View File

@ -4,44 +4,54 @@ title: projects
permalink: /projects/
description: A growing collection of your cool projects.
nav: true
display_categories: [work, fun]
horizontal: false
---
<div class="projects grid">
{% assign sorted_projects = site.projects | sort: "importance" %}
<div class="projects">
{% if site.enable_project_categories and page.display_categories %}
<!-- Display categorized projects -->
{% for category in page.display_categories %}
<h2 class="category">{{category}}</h2>
{% assign categorized_projects = site.projects | where: "category", category %}
{% assign sorted_projects = categorized_projects | sort: "importance" %}
<!-- Generate cards for each project -->
{% if page.horizontal %}
<div class="container">
<div class="row row-cols-2">
{% for project in sorted_projects %}
<div class="grid-item">
{% if project.redirect %}
<a href="{{ project.redirect }}" target="_blank">
{% include projects_horizontal.html %}
{% endfor %}
</div>
</div>
{% else %}
<a href="{{ project.url | relative_url }}">
{% endif %}
<div class="card hoverable">
{% if project.img %}
<img src="{{ project.img | relative_url }}" alt="project thumbnail">
{% endif %}
<div class="card-body">
<h2 class="card-title text-lowercase">{{ project.title }}</h2>
<p class="card-text">{{ project.description }}</p>
<div class="row ml-1 mr-1 p-0">
{% if project.github %}
<div class="github-icon">
<div class="icon" data-toggle="tooltip" title="Code Repository">
<a href="{{ project.github }}" target="_blank"><i class="fab fa-github gh-icon"></i></a>
</div>
{% if project.github_stars %}
<span class="stars" data-toggle="tooltip" title="GitHub Stars">
<i class="fas fa-star"></i>
<span id="{{ project.github_stars }}-stars"></span>
</span>
{% endif %}
<div class="grid">
{% for project in sorted_projects %}
{% include projects.html %}
{% endfor %}
</div>
{% endif %}
</div>
</div>
</div>
</a>
</div>
{% endfor %}
{% else %}
<!-- Display projects without categories -->
{% assign sorted_projects = site.projects | sort: "importance" %}
<!-- Generate cards for each project -->
{% if page.horizontal %}
<div class="container">
<div class="row row-cols-2">
{% for project in sorted_projects %}
{% include projects_hrz.html %}
{% endfor %}
</div>
</div>
{% else %}
<div class="grid">
{% for project in sorted_projects %}
{% include projects.html %}
{% endfor %}
</div>
{% endif %}
{% endif %}
</div>

View File

@ -4,6 +4,7 @@ title: project 1
description: a project with a background image
img: /assets/img/12.jpg
importance: 1
category: work
---
Every project has a beautiful feature showcase page.

View File

@ -4,6 +4,7 @@ title: project 2
description: a project with a background image
img: /assets/img/3.jpg
importance: 2
category: work
---
Every project has a beautiful feature showcase page.

View File

@ -5,6 +5,7 @@ description: a project that redirects to another website
img: /assets/img/7.jpg
redirect: https://unsplash.com
importance: 3
category: work
---
Every project has a beautiful feature showcase page.

View File

@ -4,6 +4,7 @@ title: project 4
description: another without an image
img:
importance: 3
category: fun
---
Every project has a beautiful feature showcase page.

View File

@ -4,6 +4,7 @@ title: project 5
description: a project with a background image
img: /assets/img/1.jpg
importance: 3
category: fun
---
Every project has a beautiful feature showcase page.

View File

@ -4,6 +4,7 @@ title: project 6
description: a project with no image
img:
importance: 4
category: fun
---
Every project has a beautiful feature showcase page.

View File

@ -272,6 +272,7 @@ footer.sticky-bottom {
}
}
&.active .page-link {
color: $white-color;
background-color: var(--global-theme-color);
&:hover {
background-color: var(--global-theme-color);
@ -294,17 +295,39 @@ footer.sticky-bottom {
// Projects
.projects {
.card-item {
width: auto;
margin-bottom: 10px;
a {
text-decoration: none;
}
.row {
display: flex;
align-items: center;
}
.card {
img {
width: 100%;
}
}
}
.grid-item {
width: 250px;
margin-bottom: 10px;
a {
color: black;
text-decoration: none;
&:hover {
color: var(--global-theme-color);
}
}
}
.card {
img {
width: 100%;
@ -315,6 +338,16 @@ footer.sticky-bottom {
}
}
h2.category {
color: $grey-color-light;
border-bottom: 1px solid $grey-color-light;
padding-top: 0.5rem;
margin-top: 2rem;
margin-bottom: 1rem;
text-align: right;
}
}
// Publications