-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f06c053
commit f332d04
Showing
5 changed files
with
156 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
paginate: 10 | ||
paginate_path: /posts/page/:num/ | ||
permalink: /posts/:categories/:year/:month/:day/:title/index:output_ext | ||
defaults: | ||
- values: | ||
layout: bootstrap_5.2.3 | ||
layout: bootstrap_5.2.3 | ||
- scope: | ||
type: posts | ||
values: | ||
layout: post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
layout: bootstrap_5.2.3 | ||
--- | ||
{% assign post_index = 0 %} | ||
{% for post in site.posts %} | ||
{% if post == page %} | ||
{% assign post_index = forloop.index0 %} | ||
{% break %} | ||
{% endif %} | ||
{% endfor %} | ||
{% assign post_page_number = post_index | divided_by: site.paginate | plus: 1 %} | ||
|
||
<h1 class="mb-0">{{ page.title }} | <small><a href="{% if post_page_number == 1 %}{{ '/posts' | relative_url }}{% else %}{{ '/posts/page/' | append: post_page_number | relative_url }}{% endif %}">back</a></small></h1> | ||
<p class="{% if page.tags.size > 0 %}mb-0 {% endif %}fst-italic fw-light"><small>Posted on {{ page.date | date: '%A, %-d %B %Y' }}</small></p> | ||
{% if page.tags.size > 0 %} | ||
<p> | ||
<small> | ||
{% for tag in page.tags %} | ||
<span class="badge text-bg-primary">{{ tag }}</span> | ||
{% endfor %} | ||
</small> | ||
</p> | ||
{% endif %} | ||
|
||
{{ content }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
title: CodeMap - Posts | ||
--- | ||
<h1 class="mb-4">CodeMap Posts</h1> | ||
|
||
<div class="flex-fill"> | ||
{% for post in paginator.posts %} | ||
{% unless forloop.first %}<hr>{% endunless %} | ||
{% assign post_url_index_length = '/index.html' | size %} | ||
{% assign post_url_length = post.url | size | minus: post_url_index_length %} | ||
{% assign post_url = post.url | slice: 0, post_url_length %} | ||
<h3 class="mb-0"><a href="{{ post_url | relative_url }}">{{ post.title }}</a></h3> | ||
<p class="{% if post.tags.size > 0 %}mb-0 {% endif %}fst-italic fw-light"><small>Posted on {{ post.date | date: '%A, %-d %B %Y' }}</small></p> | ||
{% if post.tags.size > 0 %} | ||
<p> | ||
<small> | ||
{% for tag in post.tags %} | ||
<span class="badge text-bg-primary">{{ tag }}</span> | ||
{% endfor %} | ||
</small> | ||
</p> | ||
{% endif %} | ||
{{ post.excerpt }} | ||
{% endfor %} | ||
</div> | ||
|
||
<nav> | ||
<ul class="mt-3 pagination pagination-sm justify-content-center"> | ||
{% assign page_offset_range = (0..4) %} | ||
{% assign page_offset_previous = page_offset_range | size | divided_by: 2 %} | ||
|
||
{% if paginator.page == 1 %} | ||
<li class="page-item disabled"> | ||
<span class="page-link">First</span> | ||
</li> | ||
{% else %} | ||
<li class="page-item"> | ||
<a class="page-link" href="{{ '/posts' | relative_url }}">First</a> | ||
</li> | ||
{% endif %} | ||
|
||
{% for page_offset in page_offset_range %} | ||
{% assign page = paginator.page | plus: page_offset | minus: page_offset_previous %} | ||
|
||
{% if forloop.first and page > 1 %} | ||
<li class="page-item disabled"> | ||
<span class="page-link">...</span> | ||
</li> | ||
{% endif %} | ||
|
||
{% if 1 <= page and page <= paginator.total_pages %} | ||
{% if page == paginator.page %} | ||
<li class="page-item active"> | ||
<span class="page-link">{{ page }}</span> | ||
</li> | ||
{% else %} | ||
<li class="page-item"> | ||
<a class="page-link" href="{% if page == 1 %}{{ '/posts' | relative_url }}{% else %}{{ '/posts/page/' | append: page | relative_url }}{% endif %}">{{ page }}</a> | ||
</li> | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% if forloop.last and page < paginator.total_pages %} | ||
<li class="page-item disabled"> | ||
<span class="page-link">...</span> | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% if paginator.page == paginator.total_pages %} | ||
<li class="page-item disabled"> | ||
<span class="page-link">Last</span> | ||
</li> | ||
{% else %} | ||
<li class="page-item"> | ||
<a class="page-link" href="{% if paginator.total_pages == 1 %}{{ '/posts' | relative_url }}{% else %}{{ '/posts/page/' | append: paginator.total_pages | relative_url }}{% endif %}">Last</a> | ||
</li> | ||
{% endif %} | ||
</ul> | ||
</nav> |