Skip to content

Commit 33287fc

Browse files
committed
Add tags and migrate to pagination v2
1 parent 79b87ac commit 33287fc

12 files changed

+209
-93
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ gem 'jekyll-dash', '~> 2'
1717
group :jekyll_plugins do
1818
gem "jekyll-feed", "~> 0.12"
1919
gem 'jekyll-tagging'
20+
gem 'jekyll-paginate-v2', '~> 3.0'
2021
end
2122

2223
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem

Gemfile.lock

+4-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ GEM
1111
http_parser.rb (~> 0)
1212
eventmachine (1.2.7)
1313
ffi (1.17.0-x64-mingw-ucrt)
14-
ffi (1.17.0-x86_64-linux-gnu)
1514
forwardable-extended (2.6.0)
1615
google-protobuf (4.27.1-x64-mingw-ucrt)
1716
bigdecimal
1817
rake (>= 13)
19-
google-protobuf (4.27.1-x86_64-linux)
20-
bigdecimal
21-
rake (>= 13)
2218
http_parser.rb (0.8.0)
2319
i18n (1.14.5)
2420
concurrent-ruby (~> 1.0)
@@ -46,6 +42,8 @@ GEM
4642
jekyll-feed (0.17.0)
4743
jekyll (>= 3.7, < 5.0)
4844
jekyll-paginate (1.1.0)
45+
jekyll-paginate-v2 (3.0.0)
46+
jekyll (>= 3.0, < 5.0)
4947
jekyll-sass-converter (3.0.0)
5048
sass-embedded (~> 1.54)
5149
jekyll-seo-tag (2.8.0)
@@ -73,12 +71,10 @@ GEM
7371
ffi (~> 1.0)
7472
rexml (3.3.0)
7573
strscan
76-
rouge (4.2.1)
74+
rouge (4.3.0)
7775
safe_yaml (1.0.5)
7876
sass-embedded (1.77.5-x64-mingw-ucrt)
7977
google-protobuf (>= 3.25, < 5.0)
80-
sass-embedded (1.77.5-x86_64-linux-gnu)
81-
google-protobuf (>= 3.25, < 5.0)
8278
strscan (3.1.0)
8379
terminal-table (3.0.2)
8480
unicode-display_width (>= 1.1.1, < 3)
@@ -91,12 +87,12 @@ GEM
9187

9288
PLATFORMS
9389
x64-mingw-ucrt
94-
x86_64-linux
9590

9691
DEPENDENCIES
9792
http_parser.rb (~> 0.6.0)
9893
jekyll-dash (~> 2)
9994
jekyll-feed (~> 0.12)
95+
jekyll-paginate-v2 (~> 3.0)
10096
jekyll-tagging
10197
tzinfo (>= 1, < 3)
10298
tzinfo-data

_config.yml

+34-57
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,57 @@
1-
# Welcome to Jekyll!
2-
#
3-
# This config file is meant for settings that affect your whole blog, values
4-
# which you are expected to set up once and rarely edit after that. If you find
5-
# yourself editing this file very often, consider using Jekyll's data files
6-
# feature for the data you need to update frequently.
7-
#
8-
# For technical reasons, this file is *NOT* reloaded automatically when you use
9-
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10-
#
11-
# If you need help with YAML syntax, here are some quick references for you:
12-
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
13-
# https://learnxinyminutes.com/docs/yaml/
14-
#
15-
# Site settings
16-
# These are used to personalize your new site. If you look in the HTML files,
17-
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
18-
# You can create any custom variable you would like, and they will be accessible
19-
# in the templates via {{ site.myvariable }}.
20-
211
title: shomy
222
description:
233
Musician, gamer and developer.
244
Currently making my dream game 🎮.
25-
baseurl: "" # the subpath of your site, e.g. /blog
26-
url: "shomykohai.github.io" # the base hostname & protocol for your site, e.g. http://example.com
5+
baseurl: ""
6+
url: "shomykohai.github.io"
277
twitter_username: shomykohai
288
github_username: shomykohai
299

10+
theme: jekyll-dash
11+
plugins:
12+
- jekyll-feed
13+
- jekyll/tagging
14+
- jekyll-paginate-v2
3015

31-
routes: [
32-
blog
33-
]
16+
defaults:
17+
-
18+
scope:
19+
path: ""
20+
type: "posts"
21+
values:
22+
permalink: "/blog/article/:title"
3423

35-
projects: [
36-
https://github.com/shomykohai/quest-system,
37-
https://github.com/shomykohai/askitsu,
38-
https://github.com/shomykohai/kitsu-bot
39-
]
24+
# For compatibility with dash's pagination.html
25+
paginate_path: /page/:num/
26+
27+
pagination:
28+
enabled: true
29+
debug: true
30+
collection: 'posts'
31+
per_page: 5
32+
permalink: 'page/:num/'
33+
title: ':title - page'
34+
sort_field: 'date'
35+
sort_reverse: true
4036

41-
paginate: 5
42-
paginate_path: "/blog/page:num"
4337

4438
tag_permalink_style: pretty
4539
tag_page_layout: tag_page
4640
tag_page_dir: tag
4741

48-
# Build settings
49-
theme: jekyll-dash
50-
plugins:
51-
- jekyll-feed
52-
- jekyll-paginate
42+
routes: [
43+
blog
44+
]
5345

46+
projects: [
47+
https://github.com/shomykohai/kitsu-bot
48+
https://github.com/shomykohai/quest-system,
49+
https://github.com/shomykohai/askitsu,
50+
]
5451

5552
dash:
5653
date_format: "%b %-d, %Y"
5754

58-
5955
social_links:
6056
- url: https://github.com/shomykohai
6157
icon: github
@@ -67,22 +63,3 @@ dash:
6763
show_author: true
6864
github-username: shomykohai
6965
avatar_source: github
70-
# Exclude from processing.
71-
# The following items will not be processed, by default.
72-
# Any item listed under the `exclude:` key here will be automatically added to
73-
# the internal "default list".
74-
#
75-
# Excluded items can be processed by explicitly listing the directories or
76-
# their entries' file path in the `include:` list.
77-
#
78-
# exclude:
79-
# - .sass-cache/
80-
# - .jekyll-cache/
81-
# - gemfiles/
82-
# - Gemfile
83-
# - Gemfile.lock
84-
# - node_modules/
85-
# - vendor/bundle/
86-
# - vendor/cache/
87-
# - vendor/gems/
88-
# - vendor/ruby/

_includes/pagination.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!-- pagination -->
2+
{% if paginator.total_pages > 1 %}
3+
<div class="pagination">
4+
{% if paginator.previous_page %}
5+
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}"><i class="fas fa-chevron-left"></i></a>
6+
{% else %}
7+
<span><i class="fas fa-chevron-left"></i></span>
8+
{% endif %}
9+
10+
{% for page in (1..paginator.total_pages) %}
11+
{% if page == paginator.page %}
12+
<span class="webjeda">{{ page }}</span>
13+
{% elsif page == 1 %}
14+
<a href="{{site.url | append: paginator.first_page_path}}">{{ page }}</a>
15+
{% else %}
16+
<a href="{{site.url | append: paginator.first_page_path }}{{ site.pagination.permalink | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
17+
{% endif %}
18+
{% endfor %}
19+
20+
{% if paginator.next_page %}
21+
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}"><i class="fas fa-chevron-right"></i></a>
22+
{% else %}
23+
<span><i class="fas fa-chevron-right"></i></span>
24+
{% endif %}
25+
</div>
26+
{% endif %}

_layouts/blog.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
layout: page
33
---
44
<h1>Articles</h1>
5-
{% assign posts_count = site.posts | size %}
5+
{% assign posts_count = paginator.total_posts %}
66
{% if posts_count > 0 %}
77
<div class="post-links">
8-
{% for post in site.posts %}
8+
{% for post in paginator.posts %}
99
<div class="post-link-wrapper">
1010
<a href="{{ post.url | relative_url }}" class="post-link">{{ post.title }}</a>
1111
<div class="post-meta">
@@ -31,7 +31,8 @@ <h1>Articles</h1>
3131
</div>
3232

3333
{% include pagination.html %}
34-
34+
<h1>All tags</h1>
35+
{% include tags.html %}
3536

3637
{% else %}
3738
This place is empty... It's awful out here, Socrates.

_layouts/home.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% include author.html %}
66
{% endunless %}
77
{{ content }}
8-
{% assign posts_count = paginator.posts | size %}
8+
{% assign posts_count = paginator.total_posts %}
99
<h1>Projects</h1>
1010
<div class="projects">
1111
{% for project in site.projects %}
@@ -49,8 +49,6 @@ <h1>Recent articles</h1>
4949
{% endfor %}
5050
</div>
5151

52-
{% include pagination.html %}
53-
{% include tags.html %}
5452
{% else %}
5553
It seems like there's nothing in here yet... mmh.
5654
{% endif %}

_layouts/post.html

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
layout: default
3+
categories: blog
4+
---
5+
{% unless site.dash.show_author == false %}
6+
{% include author.html %}
7+
{% endunless %}
8+
<div class="post">
9+
<h1 class="post-title">{{ page.title }}</h1>
10+
<div class="post-date">
11+
<i class="fa fa-clock"></i>
12+
<!-- xf017 -->
13+
Published on {{ page.date | date_to_string }}
14+
{% if page.author != null %}
15+
by {{ page.author }}
16+
{% endif %}
17+
</div>
18+
{% if page.description != null %}
19+
<noscript>
20+
<div class="post-description">{{ page.description }}</div>
21+
</noscript>
22+
<div id="animated-post-description" class="post-description" style="display: none;"></div>
23+
{% endif %}
24+
{{ content }}
25+
<div class="post-tags">
26+
{% for tag in page.tags %}
27+
<a class="tag" href="{{ tag | tag_url }}">{{ tag }}</a>
28+
{% endfor %}
29+
</div>
30+
</div>
31+
32+
{% assign size = site.related_posts | size %}
33+
{% if size != 0 %}
34+
<div class="related">
35+
<h2>related articles</h2>
36+
<ul class="related-posts">
37+
{% for post in site.related_posts limit:3 %}
38+
<li>
39+
<h3>
40+
<a href="{{ post.url }}">
41+
{{ post.title }}
42+
</a>
43+
</h3>
44+
</li>
45+
{% endfor %}
46+
</ul>
47+
</div>
48+
{% endif %}
49+

_layouts/tag_page.html

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
layout: default
3+
---
4+
{% unless site.dash.show_author == false %}
5+
{% include author.html %}
6+
{% endunless %}
7+
<h1 class="post-title">Articles tagged with: <b class="tag-name">{{ page.tag }}</b></h1>
8+
<div class="post-links">
9+
{% for post in site.posts %}
10+
{% for tag in post.tags %}
11+
{% if tag == page.tag %}
12+
13+
14+
<div class="post-link-wrapper">
15+
<a href="{{ post.url | relative_url }}" class="post-link">{{ post.title }}</a>
16+
<div class="post-meta">
17+
18+
<div class="post-tags">
19+
{% for tag in post.tags %}
20+
<a class="tag" href="{{ tag | tag_url }}">{{ tag }}</a>
21+
{% endfor %}
22+
</div>
23+
{% if site.dash.date_format %}
24+
{{ post.date | date: site.dash.date_format }}
25+
{% else %}
26+
{{ post.date | date: "%b %-d, %Y" }}
27+
{% endif %}
28+
</div>
29+
30+
</div>
31+
{% endif %}
32+
{% endfor %}
33+
{% endfor %}
34+
35+
</div>
36+
<h1>All tags</h1>
37+
{% include tags.html %}

_posts/2024-06-13-welcome-to-jekyll.markdown

-10
This file was deleted.

0 commit comments

Comments
 (0)