Skip to content

Commit

Permalink
fixed pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
cty12 committed Nov 30, 2023
1 parent c8c41a8 commit 4fcd0e6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ description: > # this means to ignore newlines until "baseurl:"
Programming language enthusiasts from Indiana University
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://wonks.github.io" # the base hostname & protocol for your site
plugins:
- jekyll-paginate
paginate_path: "/talks/page:num/"

# Build settings
markdown: kramdown
Expand Down
2 changes: 1 addition & 1 deletion _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<a class="page=link" href="/courses.html">Courses</a> |
<a class="page=link" href="/activities.html">Activities</a> |
<a class="page=link" href="/groups.html">Related Groups</a> |
<a class="page=link" href="/talks.html">Archives</a>
<a class="page=link" href="/talks">Events</a>
(<a href="/archives.html">By Category</a>)
<!-- {% for page in site.pages %}
{% if page.title %}
Expand Down
25 changes: 8 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ <h2>Upcoming Events</h2>
<ul id="upcoming-talk-list">
{% capture nowunix %}{{'now' | date: '%s'}}{% endcapture %}
{% assign cnt = 0 %}
{% for post in paginator.posts reversed %}
{% for post in site.posts reversed %}
{% capture posttime %}{{post.date | date: '%s'}}{% endcapture %}
{% if posttime >= nowunix %}
<li class="recent-talk">
Expand All @@ -239,7 +239,11 @@ <h2>Past Events</h2>
<iframe width="640" height="360" src="https://www.youtube.com/embed/f8WpBngZehA" frameborder="0" allowfullscreen></iframe>

<ul id="recent-talk-list">
{% for post in paginator.posts %}
{% assign cnt = 0 %}
{% for post in site.posts %}
{% if cnt == 10 %}
{% break %}
{% endif %}
{% capture posttime %}{{post.date | date: '%s'}}{% endcapture %}
{% if posttime < nowunix %}
<li class="recent-talk">
Expand All @@ -248,29 +252,16 @@ <h2>Past Events</h2>
{{ post.title }}</a>
<span class="date">{{ post.date | date: "(%m/%d/%Y)" }}</span>
</li>
{% assign cnt = cnt | plus: 1 %}
{% endif %}
{% endfor %}
</ul>

<p>
See the
<strong><a href="/talks.html">full list of talks</a></strong>
<strong><a href="/talks">full list of events</a></strong>
or
<span class="rss-subscribe"><a href="{{ "/feed.xml" | prepend: site.baseurl }}">subscribe via RSS</a>.
</p>

<!-- Pagination links
<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path }}" class="previous">Previous</a>
{% else %}
<span class="previous">Previous</span>
{% endif %}
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>
{% if paginator.next_page %}
<a href="{{ paginator.next_page_path }}" class="next">Next</a>
{% else %}
<span class="next ">Next</span>
{% endif %}
</div> -->
</div>
19 changes: 10 additions & 9 deletions talks.html → talks/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,33 @@
---

<div class="home">
<h2 class="page-heading">List of Talks</h2>

<h2 class="page-heading">List of All Events</h2>

<ul class="post-list">
{% for post in site.posts %}
{% for post in paginator.posts %}
<li>
<h2>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">
{{ post.date | date: "%Y.%m.%-d." }}
{{ post.title }}</a>
<small>{{ post.authors }}</small>
</h2>

</li>
{% endfor %}
</ul>

<!-- Pagination links -->
<div align="center">
<div align="center">
<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path }}" class="previous">Previous</a>
<a href="{{ paginator.previous_page_path }}" class="previous">Prev</a>
{% else %}
<span class="previous">Previous</span>
<span class="previous">Prev</span>
{% endif %}
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>
|
<span class="page_number ">Page {{ paginator.page }} of {{ paginator.total_pages }}</span>
|
{% if paginator.next_page %}
<a href="{{ paginator.next_page_path }}" class="next">Next</a>
{% else %}
Expand Down

0 comments on commit 4fcd0e6

Please sign in to comment.