From ec40eba63f7394953a91e4cc2cc54af33e0122ea Mon Sep 17 00:00:00 2001 From: Dinesh Natesan Date: Sun, 31 Oct 2021 02:28:42 +0530 Subject: [PATCH] Added Jekyll-Archives (for tags, categories) and Jekyll site-map (#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 --- Gemfile | 1 + _config.yml | 25 +++++++++++++- _layouts/archive-category.html | 27 +++++++++++++++ _layouts/archive-tag.html | 27 +++++++++++++++ _layouts/archive-year.html | 27 +++++++++++++++ _layouts/post.html | 23 +++++++++++++ _posts/2015-03-15-formatting-and-links.md | 2 ++ _posts/2015-05-15-images.md | 2 ++ _posts/2015-07-15-code.md | 2 ++ _posts/2015-10-20-comments.md | 1 + _posts/2015-10-20-math.md | 2 ++ _posts/2020-09-28-github-metadata.md | 7 ++-- _posts/2020-09-28-twitter.md | 2 ++ _sass/_base.scss | 38 +++++++++++++++++++++ blog/index.html | 40 ++++++++++++++++++++--- 15 files changed, 217 insertions(+), 9 deletions(-) create mode 100644 _layouts/archive-category.html create mode 100644 _layouts/archive-tag.html create mode 100644 _layouts/archive-year.html diff --git a/Gemfile b/Gemfile index bac9010a0936..31a554ce2bec 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' group :jekyll_plugins do gem 'jekyll' + gem 'jekyll-archives' gem 'jekyll-diagrams' gem 'jekyll-email-protect' gem 'jekyll-feed' diff --git a/_config.yml b/_config.yml index cdff539be7bd..6286aaa1bb6b 100644 --- a/_config.yml +++ b/_config.yml @@ -137,21 +137,44 @@ keep_files: # Plug-ins plugins: - - jekyll/scholar + - jekyll-archives - jekyll-diagrams - jekyll-email-protect - jekyll-feed - jekyll-github-metadata - jekyll-paginate-v2 - jekyll-responsive-image + - jekyll/scholar - jekyll-sitemap - jekyll-target-blank - jekyll-twitter-plugin - jemoji +# Sitemap settings +defaults: + - scope: + path: "assets/**/*.*" + values: + sitemap: false + # Extras github: [metadata] +# ----------------------------------------------------------------------------- +# Jekyll Archives +# ----------------------------------------------------------------------------- + +jekyll-archives: + enabled: [year, tags, categories] # enables year, tag and category archives (remove if you need to disable one of them). + layouts: + year: archive-year + tag: archive-tag + category: archive-category + permalinks: + year: '/blog/:year/' + tag: '/blog/tag/:name/' + category: '/blog/category/:name/' + # ----------------------------------------------------------------------------- # Jekyll Scholar # ----------------------------------------------------------------------------- diff --git a/_layouts/archive-category.html b/_layouts/archive-category.html new file mode 100644 index 000000000000..79aad74f923e --- /dev/null +++ b/_layouts/archive-category.html @@ -0,0 +1,27 @@ +--- +layout: default +--- + +
+ +
+

{{ page.title }}

+

an archive of posts in this category

+
+ +
+
+ + {% for post in page.posts %} + + + + + {% endfor %} +
{{ post.date | date: "%b %-d, %Y" }} + {{ post.title }} +
+
+
+ +
diff --git a/_layouts/archive-tag.html b/_layouts/archive-tag.html new file mode 100644 index 000000000000..66abaebb7380 --- /dev/null +++ b/_layouts/archive-tag.html @@ -0,0 +1,27 @@ +--- +layout: default +--- + +
+ +
+

{{ page.title }}

+

an archive of posts with this tag

+
+ +
+
+ + {% for post in page.posts %} + + + + + {% endfor %} +
{{ post.date | date: "%b %-d, %Y" }} + {{ post.title }} +
+
+
+ +
diff --git a/_layouts/archive-year.html b/_layouts/archive-year.html new file mode 100644 index 000000000000..8af1d29b2ddd --- /dev/null +++ b/_layouts/archive-year.html @@ -0,0 +1,27 @@ +--- +layout: default +--- + +
+ +
+

{{ page.date | date: "%Y" }}

+

an archive of posts from this year

+
+ +
+
+ + {% for post in page.posts %} + + + + + {% endfor %} +
{{ post.date | date: "%b %-d, %Y" }} + {{ post.title }} +
+
+
+ +
diff --git a/_layouts/post.html b/_layouts/post.html index 70d595edcc43..a67b8ac33c4d 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -2,6 +2,10 @@ layout: default --- +{% assign year = page.date | date: "%Y" %} +{% assign tags = page.tags | join: "" %} +{% assign categories = page.categories | join: "" %} + {% if page._styles %}