rewdy / pico-pagination Goto Github PK
View Code? Open in Web Editor NEWProvides basic pagination for Pico.
Provides basic pagination for Pico.
While I had a few issues getting pagination working, I got that done. As far as my setup and testing goes, seems to be working for now.
Now I have a new problem. I've just implemented the Search plugin. Both seem to be working, as long as they are separated. The issue is, I don't see how to combine the two properly. (Maybe it's just me. It's past 4 in the morning).
The issue is, that Pagination filters ahead of time from all pages. Always! I can't just throw the search result in a folder and tell the pagination plugin to go from there. The search results are being created dynamically.
The Search plugin before worked directly with the pages array. Since this caused issues with other plugins as well, they actually noticed the issue, rewrote it in 2020 and now provide a FILTER. So, the search plugin can now be applied to any array/pages that are being thrown at it. That is a great way of handling data.
The issue is, there is no sense in applying the search AFTER pagination. It should be search filter first and pagination of the resulting pages afterwards. Applying pagination as a filter as well would solve the problem.
Hi,
I tried to use it with Pico 2.1 and foound some installation issues:
[Sat Apr 01 09:45:39.898139 2023] [php7:error] [pid 837] [client 127.0.0.1:38800] PHP Fatal error: Uncaught RuntimeException: Unable to load plugin 'Pico-Pagination' from 'Pico-Pagination/Pico-Pagination.php': File not found in /var/www/html...
My solution was:
mv 10-Pagination.php Pico-Pagination.php
Next problem:
[Sat Apr 01 10:00:39.492419 2023] [php7:error] [pid 835] [client 127.0.0.1:41730] PHP Fatal error: Uncaught RuntimeException: Unable to load plugin 'Pico-Pagination' from 'Pico-Pagination/Pico-Pagination.php': Plugin class not found in /var/www/html/...
My solution was:
mv Pico-Pagination PicoPagination
mv Pico-Pagination.php PicoPagination.php
sed -e 's/class Pagination extends/class PicoPagination extends/' PicoPagination.php
Hi!
I try to use you awesome plugin. Since it seems to work with so many people, the failure lies probably on my side.
My problem: I get back to the index page, when I click on a "older/newer" link.
I include the pagination on a subpage blog
, therefore I changed the pagination_page_indicator
to blog
in my config.yml
file. The link is correct: http://myurl.com/blog/2
.
But when I click on the link I get directed to http://myurl.com
. How can I avoid this?
When using {{ pagination_links }} the generated URL contains an additional slash which seems to be not necessary.
I have a subfolder for my blog posts and use pagination_sub_page = true. This leads to the following pagination link containing an additional slash:
http://localhost/pico/**/**blog/1
Blog posts a reachable under the following URL:
Pico's default {{ next_page }} Twig variable is overwritten by this plugin. It is overwritten as a link to the next page instead of being a page object for the next page.
I ran in to problems using your plugin, along with the Tags plugin.
This is not necessarily an issue, but I am pointing out my solution.
http://www.joshrichard.net/blog/issues/pico-cms-plugin-integration-issues
Is there a way I can use this plugin to grab posts from, as an example, only page 1 and display them?
Hi,
I'm tinkering with pico CMS. I installed the blank blog theme and then tried my hand on this plugin.
I inserted the template code into the index.html of that plugin
I am running into the following issue where the pagination doesn't do what I would expect. I have created 7 bogus blog pages in content/blog/. If I now limit pagination to 3, I receive an order 3-2-2 instead of 3-3-1 as I would expect. Limit 2 yields 2-2-1-2 and limit 1 delivers a bizarre empty page 6 when pages 7,8 still have content.
Ok, to give a fair description, I now pasted the template from your Readme into the default template and found sth that should help. The odd number is the Welcome page. It appears that your plugin counts it in while the blog theme then only lists the pages that have a date.
Kind regards,
Matthias
I set up navigation on my index page. Its URL is http://eg.my.site/index , but pagination plugin creates a new URL for it http://eg.my.site/page/1 . As a result I have two URLs linking to same page.
Any ideas how to fix it?
When using {{ pagination_links }} the generated URL contains an additional slash which seems to be not necessary.
I have a subfolder for my blog posts and use pagination_sub_page = true. This leads to the following pagination link containing an additional slash:
Blog posts a reachable under the following URL without additional slash:
If pagination_sub_page is set to true shouldn't paged_pages not only return pages from pagination_page_indicator sub folder?
Otherwise I don't get the sense for this option.
How not to display all pages when there are many?
Now: 1 2 3 4 5 6 7 8 9
Necessary: 1 2 3 ... 8 9
How to get a pagination within categories? I set a custom meta tag 'category'.
I've defined:
$config['pagination_sub_page'] = true;
$config['pagination_page_indicator'] = "blog";
for posts in my /blog sub-folder, but I'd like to define another subfolder /music, for example, and be able to iterate through those for pagination. Would I need to create another array ex:paged_pages_2 to accomplish this or is there another method?
Thanks for all your work on this plugin!
Hi Andrew,
First I wanted to thank you for this plugin; I followed your instructions to set up the plugin and Pico to use it.
I have one issue though; by the time I reach the post limit for one page and the plugin kicks in, if I press next page I will the same page - e.g. all the posts listing again as for the first page instead of the one post, following the order and the age criteria.
Any ideas?
Thank you,
Razvan
I have my Pico theme set to show a static front page (on the index) and then have my list of blog entries generating on another page (/blog). This is all done through the index.html file using the twig language and if statements.
The issue I am running into, using this pagination plugin, is that when I click the 'next' link it ends up sending me to /page/2 (which is correct) but doesn't display the list containing the next set of blog entries. What get's displayed is the front page/index page.
Any thoughts?
I know the plugin works great as I've tried it on the default pico theme but I am wondering if you might have any thoughts or suggestions.
There seems to be a problem sorting articles when using sub folders. The pages are not all sorted by date but they are grouped by sub folder (with one confusing exception).
<div id="main" role="main">
<div class="container">
{{ content }}
<h1 class="postlist-header">Alle Artikel auf Freude am Film:</h1>
{% for page in paged_pages|sort_by("time")|reverse if not page.hidden %}
<div class="post">
<h2><a href="{{ page.url }}">{{ page.title }}</a></h2>
<p class="date">{{ page.date_formatted }} {% if "filmkritik" in page.url %} | Filmkritik {% endif %} {% if "werkschau" in page.url %} | Werkschau {% endif %} {% if "kurzkritiken" in page.url %} | Kurzkritiken {% endif %}</p>
<p class="excerpt">{{ page.description }}</p>
</div>
{% endfor %}
<div class="pagination">
{% if page_number > 1 %}<a href="{{ base_url }}/{{ page_indicator }}/{{ page_number - 1 }}" class="button previous">Neuere Einträge</a>{% endif %}
<div class="pages">
{% for page_num in 1..total_pages %}
<a href="{{ base_url }}/{{ page_indicator }}/{{ page_num }}"{% if page_num == page_number %} class="active"{% endif %}>{{ page_num }}</a>
{% endfor %}
</div>
{% if page_number < total_pages %} <a href="{{ base_url }}/{{ page_indicator }}/{{ page_number + 1 }}" class="button next">Ältere Einträge</a>{% endif %}
</div>
</div>
</div>
pagination_limit: 10
pagination_next_text: "Weiter >"
pagination_prev_txt: "< Zurück"
pagination_sub_page: true
pagination_page_indicator: artikel
/artikel (index [using artikel.twig] and 1 other page)
/artikel/filmkritik (9 pages)
/artikel/kurzkritiken (1 page)
/artikel/werkschau (1 page)
Sorting of all pages by date, mixing all the folders
filmkritik 9
filmkritik 8
werkschau 1
filmkritik 7
filmkritik 6
filmkritik 5
kurzkritiken 1
filmkritik 4
filmkritik 3
artikel 1
[new page]
filmkritik 2
filmkritik 1
The pages seem to be grouped by folder, except the one page from "kurzkritiken"
filmkritik 9
filmkritik 8
filmkritik 7
filmkritik 6
filmkritik 5
kurzkritiken 1
filmkritik 4
filmkritik 3
filmkritik 2
filmkritik 1
[new page]
werkschau 1
artikel 1
Is it possible, using the plugin as is, to have two links for the previous and next posts in the individual post page?
Something like this below the post's content:
| << Previous post title | Next post title >> |
I've done it like this but the order is all messed up. Seems to be sorted alphabetically instead of sorted by date:
{% if prev_page.title %}
<span class="prev-post">
<a href="{{ prev_page.url }}" rel="prev">{{ prev_page.title }}</a>
</span>
{% endif %}
{% if next_page.title %}
<span class="next-post">
<a href="{{ next_page.url }}" rel="next">{{ next_page.title }}</a>
</span>
{% endif %}
Thanks in advance for your help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.