Skip to content

Commit 6341493

Browse files
AbstractGeekalshedivat
authored andcommitted
Added Jekyll-Archives (for tags, categories) and Jekyll site-map (alshedivat#346)
* 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 * added blockquote format, jekyll-archives, tag, year archive pages, and reading time. * added archive meta to blog posts list and individual posts. * added sitemap * stylistic modifications to jekyll-archive addition * Minor fixes Co-authored-by: Maruan Al-Shedivat <[email protected]>
1 parent f638fd2 commit 6341493

15 files changed

+264
-9
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source 'https://rubygems.org'
22
group :jekyll_plugins do
33
gem 'jekyll'
4+
gem 'jekyll-archives'
45
gem 'jekyll-diagrams'
56
gem 'jekyll-email-protect'
67
gem 'jekyll-feed'

_config.yml

+24-1
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,44 @@ keep_files:
134134

135135
# Plug-ins
136136
plugins:
137-
- jekyll/scholar
137+
- jekyll-archives
138138
- jekyll-diagrams
139139
- jekyll-email-protect
140140
- jekyll-feed
141141
- jekyll-github-metadata
142142
- jekyll-paginate-v2
143143
- jekyll-responsive-image
144+
- jekyll/scholar
144145
- jekyll-sitemap
145146
- jekyll-target-blank
146147
- jekyll-twitter-plugin
147148
- jemoji
148149

150+
# Sitemap settings
151+
defaults:
152+
- scope:
153+
path: "assets/**/*.*"
154+
values:
155+
sitemap: false
156+
149157
# Extras
150158
github: [metadata]
151159

160+
# -----------------------------------------------------------------------------
161+
# Jekyll Archives
162+
# -----------------------------------------------------------------------------
163+
164+
jekyll-archives:
165+
enabled: [year, tags, categories] # enables year, tag and category archives (remove if you need to disable one of them).
166+
layouts:
167+
year: archive-year
168+
tag: archive-tag
169+
category: archive-category
170+
permalinks:
171+
year: '/blog/:year/'
172+
tag: '/blog/tag/:name/'
173+
category: '/blog/category/:name/'
174+
152175
# -----------------------------------------------------------------------------
153176
# Jekyll Scholar
154177
# -----------------------------------------------------------------------------

_layouts/archive-category.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
layout: default
3+
---
4+
5+
<div class="post">
6+
7+
<header class="post-header">
8+
<h1 class="post-title"> <i class="fas fa-tag fa-sm"></i> {{ page.title }} </h1>
9+
<p class="post-description"> an archive of posts in this category </p>
10+
</header>
11+
12+
<article>
13+
<div class="table-responsive">
14+
<table class="table table-sm table-borderless">
15+
{% for post in page.posts %}
16+
<tr>
17+
<th scope="row">{{ post.date | date: "%b %-d, %Y" }}</th>
18+
<td>
19+
<a class="post-link" href="{{ post.url | relative_url }}">{{ post.title }}</a>
20+
</td>
21+
</tr>
22+
{% endfor %}
23+
</table>
24+
</div>
25+
</article>
26+
27+
</div>

_layouts/archive-tag.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
layout: default
3+
---
4+
5+
<div class="post">
6+
7+
<header class="post-header">
8+
<h1 class="post-title"> <i class="fas fa-hashtag fa-sm"></i> {{ page.title }} </h1>
9+
<p class="post-description"> an archive of posts with this tag </p>
10+
</header>
11+
12+
<article>
13+
<div class="table-responsive">
14+
<table class="table table-sm table-borderless">
15+
{% for post in page.posts %}
16+
<tr>
17+
<th scope="row">{{ post.date | date: "%b %-d, %Y" }}</th>
18+
<td>
19+
<a class="post-link" href="{{ post.url | relative_url }}">{{ post.title }}</a>
20+
</td>
21+
</tr>
22+
{% endfor %}
23+
</table>
24+
</div>
25+
</article>
26+
27+
</div>

_layouts/archive-year.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
layout: default
3+
---
4+
5+
<div class="post">
6+
7+
<header class="post-header">
8+
<h1 class="post-title"> <i class="fas fa-calendar fa-sm"></i> {{ page.date | date: "%Y" }} </h1>
9+
<p class="post-description"> an archive of posts from this year </p>
10+
</header>
11+
12+
<article>
13+
<div class="table-responsive">
14+
<table class="table table-sm table-borderless">
15+
{% for post in page.posts %}
16+
<tr>
17+
<th scope="row">{{ post.date | date: "%b %-d, %Y" }}</th>
18+
<td>
19+
<a class="post-link" href="{{ post.url | relative_url }}">{{ post.title }}</a>
20+
</td>
21+
</tr>
22+
{% endfor %}
23+
</table>
24+
</div>
25+
</article>
26+
27+
</div>

_layouts/post.html

+23
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
layout: default
33
---
44

5+
{% assign year = page.date | date: "%Y" %}
6+
{% assign tags = page.tags | join: "" %}
7+
{% assign categories = page.categories | join: "" %}
8+
59
{% if page._styles %}
610
<style type="text/css">
711
{{ page._styles }}
@@ -13,6 +17,25 @@
1317
<header class="post-header">
1418
<h1 class="post-title">{{ page.title }}</h1>
1519
<p class="post-meta">{{ page.date | date: "%B %-d, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
20+
<p class="post-tags">
21+
<a href="{{ year | prepend: '/blog/' | prepend: site.baseurl}}"> <i class="fas fa-calendar fa-sm"></i> {{ year }} </a>
22+
{% if tags != "" %}
23+
&nbsp; &middot; &nbsp;
24+
{% for tag in page.tags %}
25+
<a href="{{ tag | prepend: '/blog/tag/' | prepend: site.baseurl}}">
26+
<i class="fas fa-hashtag fa-sm"></i> {{ tag }}</a> &nbsp;
27+
{% endfor %}
28+
{% endif %}
29+
30+
{% if categories != "" %}
31+
&nbsp; &middot; &nbsp;
32+
{% for category in page.categories %}
33+
<a href="{{ category | prepend: '/blog/category/' | prepend: site.baseurl}}">
34+
<i class="fas fa-tag fa-sm"></i> {{ category }}</a> &nbsp;
35+
{% endfor %}
36+
{% endif %}
37+
38+
</p>
1639
</header>
1740

1841
<article class="post-content">

_posts/2015-03-15-formatting-and-links.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ layout: post
33
title: a post with formatting and links
44
date: 2015-03-15 16:40:16
55
description: march & april, looking forward to summer
6+
tags: formatting links
7+
categories: sample-posts
68
---
79
Jean shorts raw denim Vice normcore, art party High Life PBR skateboard stumptown vinyl kitsch. Four loko meh 8-bit, tousled banh mi tilde forage Schlitz dreamcatcher twee 3 wolf moon. Chambray asymmetrical paleo salvia, sartorial umami four loko master cleanse drinking vinegar brunch. <a href="https://www.pinterest.com">Pinterest</a> DIY authentic Schlitz, hoodie Intelligentsia butcher trust fund brunch shabby chic Kickstarter forage flexitarian. Direct trade <a href="https://en.wikipedia.org/wiki/Cold-pressed_juice">cold-pressed</a> meggings stumptown plaid, pop-up taxidermy. Hoodie XOXO fingerstache scenester Echo Park. Plaid ugh Wes Anderson, freegan pug selvage fanny pack leggings pickled food truck DIY irony Banksy.
810

_posts/2015-05-15-images.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ layout: post
33
title: a post with images
44
date: 2015-05-15 21:01:00
55
description: this is what included images could look like
6+
tags: formatting images
7+
categories: sample-posts
68
---
79
This is an example post with image galleries.
810

_posts/2015-07-15-code.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
layout: post
3+
title: a post with code
4+
date: 2015-07-15 15:09:00
5+
description: an example of a blog post with some code
6+
tags: formatting code
7+
categories: sample-posts
8+
---
9+
This theme implements a built-in Jekyll feature, the use of Rouge, for syntax highlighting.
10+
It supports more than 100 languages.
11+
This example is in C++.
12+
All you have to do is wrap your code in a liquid tag:
13+
14+
{% raw %}
15+
{% highlight c++ linenos %} <br/> code code code <br/> {% endhighlight %}
16+
{% endraw %}
17+
18+
The keyword `linenos` triggers display of line numbers.
19+
Produces something like this:
20+
21+
{% highlight c++ linenos %}
22+
23+
int main(int argc, char const \*argv[])
24+
{
25+
string myString;
26+
27+
cout << "input a string: ";
28+
getline(cin, myString);
29+
int length = myString.length();
30+
31+
char charArray = new char * [length];
32+
33+
charArray = myString;
34+
for(int i = 0; i < length; ++i){
35+
cout << charArray[i] << " ";
36+
}
37+
38+
return 0;
39+
}
40+
41+
{% endhighlight %}

_posts/2015-10-20-comments.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
layout: post
3+
title: a post with comments
4+
date: 2015-10-20 11:59:00-0400
5+
description: an example of a blog post with comments
6+
comments: true
7+
categories: sample-posts external-services
8+
---
9+
This post shows how to add DISQUS comments.

_posts/2015-10-20-math.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ layout: post
33
title: a post with math
44
date: 2015-10-20 11:12:00-0400
55
description: an example of a blog post with some math
6+
tags: formatting math
7+
categories: sample-posts
68
---
79
This theme supports rendering beautiful math in inline and display modes using [MathJax 3](https://www.mathjax.org/) engine. You just need to surround your math expression with `$$`, like `$$ E = mc^2 $$`. If you leave it inside a paragraph, it will produce an inline expression, just like $$ E = mc^2 $$.
810

_posts/2020-09-28-github-metadata.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ layout: post
33
title: a post with github metadata
44
date: 2020-09-28 21:01:00
55
description: a quick run down on accessing github metadata.
6+
categories: sample-posts external-services
67
---
78

89
A sample blog page that demonstrates the accessing of github meta data.
910

1011
## What does Github-MetaData do?
1112
* Propagates the site.github namespace with repository metadata
12-
* Setting site variables :
13+
* Setting site variables :
1314
* site.title
1415
* site.description
1516
* site.url
@@ -28,7 +29,7 @@ A sample blog page that demonstrates the accessing of github meta data.
2829
* URL : {{ site.github.url }}
2930
* BaseURL : {{ site.github.baseurl }}
3031
* Archived : {{ site.github.archived}}
31-
* Contributors :
32+
* Contributors :
3233
{% for contributor in site.github.contributors %}
3334
* {{ contributor.login }}
34-
{% endfor %}
35+
{% endfor %}

_posts/2020-09-28-twitter.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ layout: post
33
title: a post with twitter
44
date: 2020-09-28 11:12:00-0400
55
description: an example of a blog post with twitter
6+
tags: formatting
7+
categories: sample-posts external-services
68
---
79
A sample blog page that demonstrates the inclusion of Tweets/Timelines/etc.
810

_sass/_base.scss

+38
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ footer.sticky-bottom {
277277
font-size: 0.875rem;
278278
margin-bottom: 0;
279279
}
280+
.post-tags {
281+
color: var(--global-text-color-light);
282+
font-size: 0.875rem;
283+
padding-top: 0.25rem;
284+
}
280285
a {
281286
color: var(--global-text-color);
282287
text-decoration: none;
@@ -518,3 +523,36 @@ html.transition *:after {
518523
transition: all 750ms !important;
519524
transition-delay: 0 !important;
520525
}
526+
527+
// Extra Markdown style (post Customization)
528+
.post{
529+
.post-meta{
530+
color: var(--global-text-color-light);
531+
font-size: 0.875rem;
532+
margin-bottom: 0;
533+
}
534+
.post-tags{
535+
color: var(--global-text-color-light);
536+
font-size: 0.875rem;
537+
padding-bottom: 1rem;
538+
a {
539+
color: var(--global-text-color-light);
540+
text-decoration: none;
541+
&:hover {
542+
color: var(--global-theme-color);
543+
}
544+
}
545+
}
546+
.post-content{
547+
blockquote {
548+
border-left: 5px solid var(--global-theme-color);
549+
padding: 8px;
550+
}
551+
}
552+
}
553+
554+
.post-tags {
555+
color: var(--global-text-color-light);
556+
font-size: 0.875rem;
557+
padding-top: 0.25rem;
558+
}

blog/index.html

+35-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,41 @@ <h2>{{ site.blog_description }}</h2>
2323

2424
<ul class="post-list">
2525
{% for post in paginator.posts %}
26-
<li>
27-
<h3><a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
28-
<p class="post-meta">{{ post.date | date: '%B %-d, %Y' }}</p>
29-
<p>{{ post.description }}</p>
30-
</li>
26+
27+
{% assign read_time = page.content | number_of_words | divided_by: 180 | plus: 1 %}
28+
{% assign year = post.date | date: "%Y" %}
29+
{% assign tags = post.tags | join: "" %}
30+
{% assign categories = post.categories | join: "" %}
31+
32+
<li>
33+
<h3><a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
34+
</h3>
35+
<p>{{ post.description }}</p>
36+
<p class="post-meta"> {{read_time}} min read &nbsp; &middot; &nbsp;
37+
{{ post.date | date: '%B %-d, %Y' }}
38+
</p>
39+
<p class="post-tags">
40+
<a href="{{ year | prepend: '/blog/' | prepend: site.baseurl}}">
41+
<i class="fas fa-calendar fa-sm"></i> {{ year }} </a>
42+
43+
{% if tags != "" %}
44+
&nbsp; &middot; &nbsp;
45+
{% for tag in post.tags %}
46+
<a href="{{ tag | prepend: '/blog/tag/' | prepend: site.baseurl}}">
47+
<i class="fas fa-hashtag fa-sm"></i> {{ tag }}</a> &nbsp;
48+
{% endfor %}
49+
{% endif %}
50+
51+
{% if categories != "" %}
52+
&nbsp; &middot; &nbsp;
53+
{% for category in post.categories %}
54+
<a href="{{ category | prepend: '/blog/category/' | prepend: site.baseurl}}">
55+
<i class="fas fa-tag fa-sm"></i> {{ category }}</a> &nbsp;
56+
{% endfor %}
57+
{% endif %}
58+
</p>
59+
</li>
60+
3161
{% endfor %}
3262
</ul>
3363

0 commit comments

Comments
 (0)