Howto use: Mephisto article list pagination plugin
posted: April 3rd, 2007 · by: Sven
I’ve been asked for instructions on how to use the Mephisto pagination plugin that I’ve published last week. Well, that makes sense :-) So there you go.
The plugin allows you to add very basic pagination functionality to your article section pages (that is, pages like your blog homepage, sub-section pages etc.). Right now, there are only means to add a “older posts” and “newer posts” links to access the previous and next paginated articles list’s pages - you can see this at the bottom of my blog’s homepage.
Update: The following information is most probably outdated. Please refer to the Mephisto Plugin: Paged Article Lists project page.
The plugin adds three new liquid filters for you to use. They all take the current section and pages array as a parameter. Also, you can specify different optional parameters …
The all-in-one filter
There’s a quick all-in-one filter that simply adds one or two links depending on the context (i.e. if there are older posts or not, newer posts or not):
{{ section | prev_next_section_page_links: pages }}
Use this filter to automatically output contextually “correct” links like the following:
<a class="prev" href="/page/3">« older posts</a>
<a class="next" href="/">newer posts »</a>
… you can then use the HTML class attributes to let the links float to the left and right side of the page respectively - like you can see on my blog homepage.
Also, you can define a separator as a third parameter:
{{ section | prev_next_section_page_links: pages, '·' }}
… which will be inserted between the both links, if both are present.
<a class="prev" href="/page/3">« older posts</a> ·
<a class="next" href="/">newer posts »</a>
More power to the people
These automatic links might not always be what you want. Maybe you need another link text. Or you want to enclose the links in some other tags …
You might then want to use the following filters that each just generate one link according to the context:
{{ section | link_to_prev_section_page: pages }}
{{ section | link_to_next_section_page: pages }}
… which again will get you the same output as above. But this time you can better control the placement of your tags:
<a class="prev" href="/page/3">« older posts</a>
<a class="next" href="/">newer posts »</a>
Also, you can now specify the link text as the third parameter:
{{ section | link_to_prev_section_page: pages, "silence is foo!" }}
{{ section | link_to_next_section_page: pages, "where there's foo, there's fire" }}
How to install
You can install this by using Rails’ script/plugin installer. Standing in your application’s root directory do:
script/plugin install http://svn.artweb-design.de/stuff/mephisto/mephisto_paged_article_list
That should suffice :-)
Don’t forget to restart your webserver after messing with your plugins!
W. Andrew Loe III said May 19th, 2007 at 01:14 AM ¶
Excellent plugin.
Is there a way to force this to allow pagination for a specific section? I’m using your template and it properly generates mysite.com/section/page/2 links but that doesn’t paginate the section, it pulls up page 2 of everything.
W. Andrew Loe III said May 19th, 2007 at 02:26 AM ¶
I should clarify that comment. I think I may have an issue with how my sections are setup. I have every article in my “Home” section which has a path of nothing (so it shows up at mysite.com/). Is this correct?
When I go to mysite.com/section/page/2 I get exactly the same as mysite.com/page/2 its not filtering to just the section. Though this works for archives without any problem.
Ideas?
Sven said May 19th, 2007 at 02:46 AM ¶
Hey!
As far as I understand what you mean this behaviour can be seen here: http://journal.andrewloe.com/computers-and-technology/page/2 Right? Even worse: if you look at the “older posts” link at the bottom of that page you see that it points to http://journal.andrewloe.com/page/3 (and not page 3 of that section)!
So that’s severely foobared :-/ I vaguely remember that I’ve seen this behaviour myself. I just can’t remember what I’ve done to solve it. (It’s not here on my own blog. See: http://localhost:3000/programming/page/2)
Hum. Are you sure that you have the latest version of the plugin? I guess I’ve probably forgot to check in my latest fixes or so.
Sven said May 19th, 2007 at 03:05 AM ¶
Please update (or reinstall) the plugin. I’ve just checked in a change that I’ve obviously forgot about.
http://stuff.artweb-design.de/trac/changeset/38
My shame. Big sorry for the inconvenience!
Please email me if that doesn’t fix your problem (don’t forget to restart your server if needed).
W. Andrew Loe III said May 21st, 2007 at 04:41 AM ¶
Awesome! It works fantastically now, thank you for your work.
Will Duncan said June 21st, 2007 at 12:28 PM ¶
I spent like 3 hours searching the documentation and then the google group and came up empty handed (no thanks to google thinking I was a bot while searching the group).
It blew my mind when I noticed that there was no pagination built into Mephisto. I was sure I was missing something till I went to about 20 fully populated Mephisto powered blogs/sites only to realize that if you went to a category that didn’t list everything you were screwed if they didn’t have an Archive section.
But even if they did have an archive section it meant clicking individual articles and backing out. Not much for for someone browsing through a blog.
This worked right out of the box. Thanks so much.
Sven said June 26th, 2007 at 02:09 PM ¶
Hey Will, I believe that the decision to omit pagination from Mephisto by default has several negative consequences: not only regarding SEO and spiders but also humans who simply searching for a specific article. (This once drove me crazy on Jamis Buck’s blog.)
zerohalo said August 4th, 2007 at 10:11 PM ¶
Finally, sanity! Thank you, Sven.
zerohalo said August 4th, 2007 at 11:02 PM ¶
Sven, does this work on Mephisto trunk? I’ve tried it (rev 2920) and it throws an exception on line 20 with NameError (uninitialized constant ActionController::Pagination).
It does work with an older installation of Mephisto (rev 2561) that I have.
zerohalo said August 4th, 2007 at 11:42 PM ¶
PS. Sorry, I should have dug around a bit more before posting that last note.
The problem is not with a change in the Mephisto trunk, but rather in Rails edge, which the latest Mephisto pulls in. ActionController::Pagination is no more (I had heard they were going to pull it from Rails and have it as a plugin). I couldn’t find the new pagination plugin, but maybe it’s yet to come.
Sven said August 11th, 2007 at 06:31 PM ¶
zerohalo, thanks for tracking that down.
Actually I haven’t even noticed that change as I’ve frozen my Mephisto/Rails installation and haven’t touched it for the last two months or so.
Please let me know if you find a solution for this. I’ll want to update the plugin accordingly of course.
Mika Tuupola said August 22nd, 2007 at 10:57 AM ¶
Would it be possible to expand this plugin to support paged tag pages. If I understood correctly now it pages only sections.
Thanks for great plugin!
Sven said August 23rd, 2007 at 11:12 PM ¶
Mika,
this should be possible, yes. I vaguely recall that there’s been some Mephisto bug with tags and tag pages. I promise I’ll have a look at it within the next days. Thanks for the hint!
Sven said September 7th, 2007 at 08:17 PM ¶
Hey Mika,
I just wanted to drop you the note that the current version in SVN will page your tag pages. You’ll need to switch to Mephisto Edge though … which hopefully won’t be an issue for you. Otherwise just contact me by mail. I guess that functionality can be backported easily.
Mark Guzman said September 11th, 2007 at 06:39 AM ¶
Hi Sven, I love the plugin. I just got it setup on my blog. I noticed that the main pagination call doesn’t limit the dataset to published articles. Just a heads up, I’ve fixed it on my end. Thanks for the plugin.
Sven said September 11th, 2007 at 12:33 PM ¶
Hey Mark,
thanks for the heads up! That’s fixed. I would have never noticed that myself as the unpublished articles were sorted to the very end of the paged lists.
On a sidenote: are you fine with these pagination links (“older/newer posts”) as they are? Otherwise I’d suggest to float these links to the left and right side … something like this:
Matthew said September 20th, 2007 at 05:07 PM ¶
Great plugin thanks a lot.
jack said January 23rd, 2011 at 11:40 AM ¶
thanks for that headsup. That’s a useful tip! I’ve never ran into that, but for sure that’s something quite some people will need a solution for. cheap vps
QQQ said February 7th, 2011 at 06:33 PM ¶
Finally we kissed and the passion scale went sky high and I knew I was onto a good thing - sex was a certainty free porn videos. She never hesitated when I began to fondle her breasts and she willingly exposed them for me mobile porn. They were firm and I suspected a breast enhancement but said nothing - they still felt good and I was enjoying them and gradually working my way further south free porn tube. She was a step ahead of me and before I could completely undress her she moved on me atk hairy and I was suddenly having my pants pulled down and I was enjoying one of he best cock sucking hairy pussy experiences I had ever had. ABB728019394
Foana2 said February 24th, 2011 at 08:00 AM ¶
I assumption we’ve ample that in clandestine email by now, but to accept the acknowledgment here, pass4sure 70-401 too, the botheration was that ngix didn’t advanced requests for JS and CSS files to Rails at all. pass4sure 70-403 By either alteration the ngix conf or application the /bundles avenue things should work. pass4sure 70-441 For those accepting issues with errors occuring during migrations, I’m not abiding what the affair is. pass4sure 70-445 I’ve been application the plugin for ages now while application migrations and accept never apparent an error.
Go ped said February 24th, 2011 at 01:51 PM ¶
thanks for the heads up! That’s fixed. I would have never noticed that myself as the unpublished articles were sorted to the very end of the paged lists. Go Ped
chat said March 31st, 2011 at 07:37 PM ¶
The following fix helped with mephisto:
The following cleaned up the issue:
Dependencies.loadoncepaths -= Dependencies.loadoncepaths.select{|path| \ path =~ %r(^#{File.dirname(FILE)}) }
Okey oyunu said May 12th, 2011 at 04:06 PM ¶
Thanks for this article. Tüm dünya artik okey oyunu oynuyor. Yillardir bir çok oyun programi olmasina ragmen, içlerinden en güzeli olarak nitelendirebilecegimiz tek bir site göze çarpmaktadir. Diger tüm okey oyunu programlarinin aksine ücretsiz olmasi ve 3 boyutlu olarak hizmet vermesi mükemmel bir gelismedir. Sizlerde www.okey-oyunu.com adresinden bu essiz okey oyununu indirebilirsiniz. Kullanimi çok basit ve Türkçe dil seçenegi ile kolaylikla oyuna baslayabilirsiniz. Ister kendi ülkenizden, isterseniz dünyanin tüm farkli bölgelerinden dilediginiz oyun odalarini seçerek, oyuna hemen baslayabilirsiniz. Okey oyunu oynamak için artik arkadas bile aramaniza gerek kalmadan, bilgisayarinizdan 100 binlerce üye ile online olarak okey oyununu oynamanin zevkine varabilirsiniz.
porno said May 22nd, 2011 at 01:32 PM ¶
I do agree with all of the ideas you have presented in your post. They’re really convincing and will definitely work. Still, the posts are too short for newbies. Could you please extend them a bit from next time? Thanks for the post.
porno said May 22nd, 2011 at 02:11 PM ¶
good comment. thanks you friends.
I’ve surfed the net more than three hours today, however, I haven’t found such useful information. Thanks a lot, it is really useful to me