Skip to content

Commit

Permalink
Categories for projects and an optional horizontal project card style…
Browse files Browse the repository at this point in the history
… (#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 <[email protected]>
  • Loading branch information
AbstractGeek and alshedivat authored Apr 11, 2021
1 parent 0e4df83 commit e27fe2a
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 53 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ $ bundle exec jekyll build
which will (re-)generate the static webpage in the `_site/` folder.
Then simply copy the contents of the `_site/` foder to your hosting server.

**Note:** Make sure to correctly set the `url` and `baseurl` fields in `_config.yml` before building the webpage. If you are deploying your webpage to `your-domain.com/your-project/`, you must set `url: your-domain.com` and `baseurl: /your-project/`. If you are deploing directly to `your-domain.com`, leave `baseurl` blank.
**Note:** Make sure to correctly set the `url` and `baseurl` fields in `_config.yml` before building the webpage. If you are deploying your webpage to `your-domain.com/your-project/`, you must set `url: your-domain.com` and `baseurl: /your-project/`. If you are deploing directly to `your-domain.com`, leave `baseurl` blank.

</details>

Expand Down Expand Up @@ -244,7 +244,7 @@ scholar:
last_name: Einstein
first_name: [Albert, A.]
```
If the entry matches the last name and one form of the first names, it will be underlined.
If the entry matches the last name and one form of the first names, it will be underlined.
Keep meta-information about your co-authors in `_data/coauthors.yml` and Jekyll will insert links to their webpages automatically.
The coauthor data format in `_data/coauthors.yml` is as follows,
```
Expand All @@ -260,14 +260,14 @@ The coauthor data format in `_data/coauthors.yml` is as follows,
- firstname: ["Nathan", "N."]
url: https://en.wikipedia.org/wiki/Nathan_Rosen
"Bach":
"Bach":
- firstname: ["Johann Sebastian", "J. S."]
url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach
- firstname: ["Carl Philipp Emanuel", "C. P. E."]
url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach
```
If the entry matches one of the combinations of the last names and the first names, it will be highlighted and linked to the url provided.
If the entry matches one of the combinations of the last names and the first names, it will be highlighted and linked to the url provided.

</details>

Expand Down
18 changes: 11 additions & 7 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions _includes/projects.html
Original file line number Diff line number Diff line change
@@ -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>
40 changes: 40 additions & 0 deletions _includes/projects_horizontal.html
Original file line number Diff line number Diff line change
@@ -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>
80 changes: 45 additions & 35 deletions _pages/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}
{% for project in sorted_projects %}
<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 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 %}
{% include projects_horizontal.html %}
{% endfor %}
</div>
</div>
{% else %}
<div class="grid">
{% for project in sorted_projects %}
{% include projects.html %}
{% endfor %}
</div>
{% endif %}
{% 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>
</a>
</div>
{% endfor %}
{% endif %}

{% endif %}

</div>
1 change: 1 addition & 0 deletions _projects/1_project.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions _projects/2_project.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions _projects/3_project.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions _projects/4_project.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions _projects/5_project.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions _projects/6_project.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
47 changes: 40 additions & 7 deletions _sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -294,25 +295,57 @@ 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%;
}
.card-title {
color: $black-color;

.card {
img {
width: 100%;
}
.card-title {
color: $black-color;
}
}
}

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;
}
}


Expand Down

0 comments on commit e27fe2a

Please sign in to comment.