-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toughts on all new Jekyll pagination system #27
Comments
Just to clarify, my intention is not to hijack or maintain the project, but if You share my ideas then would be good if the maintainers would create some new branch (eg |
👍 |
Feel free to build it, test it, and share widely. I worked on an idea in #22 but I just can't get excited about pagination. My vote is to kill off this version and move in a new vision that is as easy as possible to use, but still flexible. |
Imo the hardest part with the pagination is the templating which gets pretty complicated if You want to create more awesome paginators. But I can't see any other way than making lots of examples, to make it easier. |
so there is no way right now to currently to paginate posts in certain categories without a plug-in correct? |
@d3netxer, correct. |
well, if this was built-in to Jekyll it probably would have save me 6 plus hours. What I ended up doing was making a json feed of the posts with the category of 'news'. I then used Javascript to create html templates of the posts from the json feed and display them. I used a little bit more javascript and Jquery to load more entries in an AJAX fashion. The good news is that it is nice to have a json feed anyway of my posts, and I like how the AJAX responds. |
Anyone know a good plugin that achieves the above problem (paginate posts in certain categories) ? |
@gynter are you still actively working on this? |
I think this would work best if its done something like this but it requires more documentation for newbies. just so that if the link gets moved. I enabled the collection in the _config.yml and created the folder _tripcollection in the root. collections: {% for c in site.tripcollection %} {% for c in site.tripcollection %} {% if nextflag == 1 %}
{% if prevPost.url %}
< {{prevPost.title}}
{% endif %}
{% if nextPost.url %}
{{nextPost.title}} >
{% endif %}
I see you raised your eyebrows looking at the code above. It works and got it working after number of hit and trials. It’s just pure logic, it looked complicated because of lack of language constructs in liquid template. Now you get previous and next links in your collection posts as well. See the working demo here. |
It's hinted at in the suggestion, but it sounds like realistically @gynter is suggesting a new version of Jekyll that's a rewrite. Edit: I mistakenly called this "Jekyll 2.0" referring to the type of versioning system where major point releases are complete rewrites. Jekyll, of course has an actual v2.0 that is not based on this system. |
No you see the the pagination feature is completely disabled and only pure logic is used so if they give a standard for pagination using some more predefined variables with a highly explained documentation in layman terms it should be easy. I don't know how it was for jekyll 2.0 i have used jekyll only for the last two weeks. |
Hey everybody, I know this is an old thread but I wrote a pagination plugin for Jekyll that supports all of the features described in this post. Hoping that it might be a viable alternative for the old jekyll-paginate gem https://github.com/sverrirs/jekyll-paginate-v2 |
@sverrirs I think this is worth exploring. But your new gem has a bit of chicken-and-egg problem. Its hard to get people to care about a new (better) gem that nobody uses when we could use a (maybe worse) gem that everyone uses. Can you show some real public web sites that are currently using your pagination plugin? Its a really hard sell without that. Are you really committed to pouring in the time it takes to make this effort successful? Lots of folks pop up on github with something half-baked and 6 months later abandon their project. You could literally be signing up for years of finding/fixing annoying little bugs and arguing with other people on github. If you're still on board, I'd love for you take this on and I'll test your plugin with my own jekyll site and give you feedback. |
@stevecrozz Thanks for the comment and you're right in a sobering way :) My motivation for building this plugin/gem is to be able to provide a viable migration alternative from Wordpress for a client of mine (pitching Jekyll as the alternative). So I have a vested interest in seeing this through. I currently have my own personal blog using this paginator logic but it doesn't really have a multi category structure or some of the more advanced features this plugin supports. But at least one system has it, but then again I only completed the paginator code this morning. I am committed to building a viable production-ready alternative to the old paginator but my ultimate goal is to eventually hand this repo over to the Jekyll team if they deem it worthy (and hopefully gather some contributors along the way). But I'm in for the long haul. At this point my main focus is on hardening the code and the feature set that it currently has. Then publish the first version of the gem. Unless critical to the plugin I would like to put additional "nice-to-have" features on standby until these initial goals are properly completed. I'd be glad and grateful to have you help me testing this. |
@sverrirs Once you feel your updated version is stable and ready for prime-time, I could be convinced to give you the keys to this repo (jekyll/jekyll-paginate) and/or allow you put your repo in this project and make it the new default Jekyll pagination solution. We could even see about getting it onto GitHub Pages to replace the current jekyll-paginate if it's compatible with jekyll-paginate. |
@parkr Thank you Parker. I will be in touch. |
@stevecrozz,. @parkr and everybody else. The latest stable release before compatibility code was added is v1.2.0 (https://rubygems.org/gems/jekyll-paginate-v2/versions/1.2.0) |
@sverrirs I got around to upgrading my blog to Jekyll v3 and included switching to jekyll-paginate-v2 in the process. There were plenty of issues I encountered during the upgrade, but jekyll-paginate-v2 was one of the simplest parts of the process. I did make a few mistakes and if you're open to discussing it, we could talk over an idea I've got on how to make debugging a little easier. You can send me an email if you want to talk that over. One thing you might find interesting is my implementation of tag indexes (https://github.com/stevecrozz/lithostech.com/blob/4f6ac029b71a01b459a860739c5e4297664fd9e1/_plugins/tag_indexes.rb) which I thought would be one of the trickier parts of the process because of the way I had been abusing the old jekyll-paginate. But my new solution ended up being even simpler than the previous version. I even found that this new tag index implementation based on jekyll-paginate-v2 fixes a bug that hadn't noticed before. Granted, my blog is a pretty simple project, but my results were good and I plan to keep it on jekyll-paginate-v2. Thanks for sharing your project and being willing to support a new pagination system for jekyll! |
@stevecrozz Thank you for the kind words. I'm really glad that the experience with the pagination code was good. I would really love some feedback on the whole project. If you feel that your comments are appropriate for the general public then we can discuss it openly at https://github.com/sverrirs/jekyll-paginate-v2/issues otherwise I am more than willing to have a one-on-one through email. Ping me your thoughts at [email protected]. Also, thank you for the tag_indexes.rb link. It is a really neatly implemented solution 👍 I have been thinking about how to do this cleanly for categories/tags/collections incorporating the paginate-v2 logic. Do you mind if I take this code and expand on it and perhaps publish it as an accompanying gem for the pagination-v2 gem? |
@sverrirs You're certainly welcome to take and use/extend/publish any code you find in my blog. Cheers! |
The post below is long, longer than I tought it'll be, but please read it all 😄
I hope that others including the maintainers of the project, have similar toughts on the topic and see it as a way to go forward with the project making it more feature rich and customizeable even for more complex web pages. My intention is not to fragmentize the community, thats why I posted my ideas here instead of creating another fork and just doing "my stuff".
Why I'm doing this?
Hello, like others here I'm dedicated Jekyll user and have built many websites, including my own, on Jekyll.
The most time consuming part was to find a suitable solution to produce multilingual site with customized and filtered pagination pages. Currently Jekyll pagination has no support for that. Yes, there are a lot of alternatives, each of them have different goal, but any of them exactly suitable for my needs - lack of documentation and sometimes hard or even overkill to implement.
I propose to write all new Jekyll pagination system, from scratch. Some of You might ask, why write here, why I don't just fork it and make my changes? Well I kind of did that already, but this is not the solution.
In my opinion projects like this should be kept together and developed as one which guarantees one good source of the software.
My idea is to start from scratch (we could reuse useful code), create an experimental repository, but first we should map our needs, toughts and other hardcore awesome ideas.
The ideas listed below are my personal toughts on the subject, feel free to express Your toughts. The ideas are based on my experience and from issues of the project.
If maintainers think that I'm overstepping my boundaries (I hope that I'm not 😃), feel free to close and lock this issue.
What I would like to achieve?
Architecture
Current architecture is limited only to posts. Referring to #22 I think it should be able to paginate all Jekyll content types: pages, posts and collections.
Code clarity
Make classes independent (#26). Currently there's huge hell in Pager class. The class should be completely independent and all variables should be passed to it as separate and well defined arguments.
Layouts/templates
Jekyll has a well defined layout system and for clarity we should use it instead of defining html files directly and relative of the root directory. Defining layout like
myblog
whould use template_layouts/myblog.html
.Pemalinks
With this way we should also separate layout from permalinks (#22). This would make a life lot of easier for multilingual page. Default permalink should point to the layout, if layout is
myblog
then permalink is/myblog:num
. The first page is/myblog.html
unless, there is a missingindex.html
in the same directory, then the first page is/index.html
. Other pages would still be/myblog2/index.html
,/myblog3/index.html
etc.Filtering
When converting my site to multilingual I researched some other plug-ins which added support for pagination by category. Since Jekyll is in my opinion pretty abstract we shouldn't focus on one filter variable
category
, but it should be configureable (for example, I filter my posts usinglanguage
). We should also keep in mind that the frontmatter variables can have multiple values so support for lists as filter value is needed (eg filter posts bylanguage
values[ "et_EE", "en_US" ]
). Also support for both include and exclude filters would be a good feature (include all categoryX
, but exclude if also in categoryY
).Sorting
Custom sorting would be awesome feature. The default should be same behavior as now (by
date
descending), but we should make it configurable, so we could use other fontmatter variables and values for sorting, try to detect automatically if alphabetically or chronologically. For pages and collections the default should by filename alphabetically ascending.Avoiding existing mistakes
Both open and closed issues should be taken in consideration when building new system so we don't step on the same rake over and over again.
Compatibility
Everything must be backwards compatible. The new code must support the old config layout otherwise a lot of web pages will break and that's not acceptable.
Proposed config syntax (based on #22)
I'm proposing the configuration syntax below.
Note, that if
posts
,pages
orcollections
are not defined as lists, then those objects are not considered as multipagination (if you only want one pagination page, then You can use associative arrays directly as those node's values:The code above would also be the shortest code to enable pagination for posts. There is no need to define
permalink
here and if You don't have/index.html
then default permalink is considered to be that, but if You do, then first page will be/blog.html
(see the Permalinks paragraph).How could I achieve that?
As stated in the introduction, the idea is to create an experimental repository (milestone 2.0.0?) which would contain all the new Jekyll pagination. We all have our daily jobs to do, so this probably won't be finished this month, not even next or even might not be in this year, but we would have a straight goal and sight where to go next. All useful contributions from everyone would be welcome 😄 .
How can You help?
I'm slightly new to Ruby world, but I have extensive and long time knowledge of PHP, Python, various *nix shells' script languages etc. To be honest those two commits from my fork's experimental branch are basically my first serious contact with Ruby world.
Note: I don not encourage nor recommend to use this code in production, it's not a solution to existing issues, it's a hack which I quickly made to add multilingual support to my site.
Yes, I can write the code but I have no knowledge of other Ruby stuff including inline documenting, unit testing, packaging and distribution - so thats where the most of help would be needed.
The text was updated successfully, but these errors were encountered: