liddlelab-theme 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c358385f8797836484c2fd4451a29569877c835e1bae2127b1198033db051f72
4
- data.tar.gz: 396ee77d8072998db6697b7bba6eed374daba585b0ce26a185e6ff08363a1945
3
+ metadata.gz: 2dbfb332c90448bd1c9241bb8427b3b329a5552ac68b7a7e89173e3062dd8cc5
4
+ data.tar.gz: 2df038cfdf016b04e297c24592566fcabce23afc3535289169e472285315c77d
5
5
  SHA512:
6
- metadata.gz: d8d4182234538efed42b037e414e82febfde905eff74bf8ea2c28841cd605ed19bb443d1733c42c5f820a83f101f544faf085b02843a6642eebd1410e78a7da6
7
- data.tar.gz: bdd93ec1aa98122603524cb4f4616108e07c553e904b7948a00ed987a8beb7821684cc99458a624591ab58146b4d2a53825512b48a463a2b16f12a075bf68fac
6
+ metadata.gz: c05544f395af55e596525981bc81d3f40ea9e39168eb406169f7090b4169e36c99ba984aa3b99f569123d0a4c6f1044663b251fdeb842d12b1cf2e6aea460b23
7
+ data.tar.gz: 3bca68ed2d4c86af42026dce88ea3673250b56090116e5ea2a6d5639130648562c1bca3070c1ea1ede4d72be045fa7145a3679f98aab3f6fd08ee56468ee03f5
@@ -33,11 +33,11 @@
33
33
 
34
34
  {% for pagelink in site.pages %}
35
35
  {% if pagelink.url == "/" %}
36
- {% elsif pagelink.url == "/blog/" %}
37
36
  {% elsif pagelink.url == "/404.html" %}
38
37
  {% elsif pagelink.title == nil or pagelink.title == "" %}
39
38
  {% elsif pagelink.title == "Categories" %}
40
39
  {% elsif pagelink.title == "Tags" %}
40
+ {% elsif pagelink.url contains "/blog/" %}
41
41
  {% elsif pagelink.url contains "/category/" %}
42
42
  {% else %}
43
43
  {% if page.url == pagelink.url %}
data/_layouts/post.html CHANGED
@@ -122,10 +122,10 @@ post_class: post-template
122
122
  <!-- Prev/Next -->
123
123
  <div class="row PageNavigation d-flex justify-content-between font-weight-bold">
124
124
  {% if page.previous.url %}
125
- <a class="prev d-block col-md-6" href="{{ site.baseurl }}/{{page.previous.url}}"> &laquo; {{page.previous.title}}</a>
125
+ <a class="prev d-block col-md-6" href="{{page.previous.url}}"> &laquo; {{page.previous.title}}</a>
126
126
  {% endif %}
127
127
  {% if page.next.url %}
128
- <a class="next d-block col-md-6 text-lg-right" href="{{ site.baseurl }}/{{page.next.url}}">{{page.next.title}} &raquo; </a>
128
+ <a class="next d-block col-md-6 text-lg-right" href="{{page.next.url}}">{{page.next.title}} &raquo; </a>
129
129
  {% endif %}
130
130
  <div class="clearfix"></div>
131
131
  </div>
@@ -0,0 +1,39 @@
1
+ // identify our page number statically
2
+ // get ready to load the next page
3
+ // on a scroll down, load the next page of results and append it in the #postlist container
4
+ let currentPage = 1;
5
+ let loading = false;
6
+ let hitEnd = false;
7
+ const loadMorePosts = async () => {
8
+ if (hitEnd) return; // Prevent loading more if we've hit the end
9
+ try {
10
+ currentPage++;
11
+ const response = await fetch(`/blog/page${currentPage}`);
12
+ if (!response.ok) throw new Error('Failed to load posts');
13
+ const newPosts = await response.text();
14
+ const parser = new DOMParser();
15
+ const doc = parser.parseFromString(newPosts, 'text/html');
16
+ const tempDiv = document.createElement('div');
17
+ tempDiv.innerHTML = doc.getElementById('postlist').innerHTML;
18
+ const postList = document.getElementById('postlist');
19
+ if (tempDiv.children.length < 10) {
20
+ hitEnd = true; // No more posts to load
21
+ }
22
+ while (tempDiv.firstChild) {
23
+ postList.appendChild(tempDiv.firstChild);
24
+ }
25
+ loading = false;
26
+ } catch (error) {
27
+ hitEnd = true;
28
+ console.error('Error loading more posts:', error);
29
+ }
30
+ };
31
+
32
+ window.addEventListener('scroll', () => {
33
+ if (loading || hitEnd) return; // Prevent multiple loads
34
+ const postList = document.getElementById('postlist');
35
+ if (window.innerHeight + window.scrollY >= postList.offsetTop + postList.offsetHeight - 100) {
36
+ loading = true;
37
+ loadMorePosts();
38
+ }
39
+ });
data/blog/index.html CHANGED
@@ -2,53 +2,16 @@
2
2
  layout: default
3
3
  title: Blog
4
4
  ---
5
-
6
- <section class="featured-posts">
7
- <div class="section-title">
8
- <h2><span>Featured</span></h2>
9
- </div>
10
- <div class="row">
11
-
12
- {% for post in site.posts %}
13
-
14
- {% if post.featured == true %}
15
-
16
- {% include featuredbox.html %}
17
-
18
- {% endif %}
19
-
20
- {% endfor %}
21
-
22
- </div>
23
- </section>
24
-
5
+ <script src="/assets/js/paginateScroll.js"></script>
25
6
  <!-- Posts Index
26
7
  ================================================== -->
27
8
  <section class="recent-posts">
28
-
29
9
  <div class="section-title">
30
-
31
- <h2><span>All Stories</span></h2>
32
-
10
+ <h2><span>Articles</span></h2>
33
11
  </div>
34
-
35
- <div class="row listrecent">
36
-
12
+ <div class="row listrecent" id="postlist">
37
13
  {% for post in paginator.posts %}
38
-
39
14
  {% include postbox.html %}
40
-
41
15
  {% endfor %}
42
-
43
16
  </div>
44
-
45
- </section>
46
-
47
- <!-- Pagination
48
- ================================================== -->
49
- <div class="bottompagination">
50
- <div class="pointerup"><i class="fa fa-caret-up"></i></div>
51
- <span class="navigation" role="navigation">
52
- {% include pagination.html %}
53
- </span>
54
- </div>
17
+ </section>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liddlelab-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Liddle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-24 00:00:00.000000000 Z
11
+ date: 2025-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll-seo-tag
@@ -172,6 +172,7 @@ files:
172
172
  - assets/img/sample2.jpg
173
173
  - assets/js/lunr.js
174
174
  - assets/js/lunrsearchengine.js
175
+ - assets/js/paginateScroll.js
175
176
  - blog/index.html
176
177
  homepage: https://liddlelaboratory.com
177
178
  licenses: