Is there a way to get at the X most recent articles in the Liquid templates? If so, what is the Liquid tag(s) I should be using? Also, pagination - how do I get at them? I managed to figure it out for seach.liquid by looking at the code for Mephisto (the 'search' method in MephistoController) and using the 'next_page' and 'previous_page' drops, but when I try to do the same for home.liquid and section.liquid, it gives a URL which tries to contains the Pagination object printed as a string (like '<Pagination:023AD...>'.
One last thing - is it possible to get at the next and previous article relative to the current article (in single.liquid)?
I've been trying to figure these out by looking at the Mephisto wiki and at the source to no avail. The Liquid template system is proving to be pretty restrictive and somewhat unnecessary when we have eRb templates the more I try to work with it :/
On Sat, Sep 30, 2006, chuyeow wrote: > Is there a way to get at the X most recent articles in the Liquid > templates? If so, what is the Liquid tag(s) I should be using?
I built a "recent stuff" doohickey for my sidebar, which shows the 10 most recent posts with the 5 most recent comments on each. Here it is:
<dl> {% for article in articles limit: 10 %} <dt>{{ article | link_to_article }}</dt> {% if article.comments_count > 0 %} {% for comment in article.comments limit: 5 %} <dd>{{ comment.body | truncatewords: 10 }}</dd> {% endfor %} {% else %} <dd>No comments</dd> {% endif %} {% endfor %} </dl>
I'm a total liquid/mephisto newbie, so there might be a better way to do that. If someone knows one, I'd like to hear it!
One interesting side effect (that I like, actually) is that if you're looking at a single article, it'll only show that article. I presume that if you're looking at search results, you'll only see those. I like that.
I don't know the answer to any of your other questions, sorry.
Ahh thanks for the reply Ben. I actually can get that working for the home page, no problem, but if I'm understanding you correctly you also only can get it working for the home page.
I guess I'm looking for something like a 'recent_articles' drop or 'all_articles | recent: 5' drop + filter.
> Ahh thanks for the reply Ben. I actually can get that working for the > home page, no problem, but if I'm understanding you correctly you also > only can get it working for the home page.
> I guess I'm looking for something like a 'recent_articles' drop or > 'all_articles | recent: 5' drop + filter.
Eek so those are new in trunk (I'm still using 0.6). Guess I should try and get a trunk deploy going. Thanks.
Regarding paging, unless trunk has changed the way articles are displayed, wouldn't that mean that if the 'article per page' is set to say 10, and you browse a particular section's articles, you would be limited to showing only the latest 10 since you can't page further?
> Eek so those are new in trunk (I'm still using 0.6). Guess I should try > and get a trunk deploy going. Thanks.
> Regarding paging, unless trunk has changed the way articles are > displayed, wouldn't that mean that if the 'article per page' is set to > say 10, and you browse a particular section's articles, you would be > limited to showing only the latest 10 since you can't page further?
On Sat, Sep 30, 2006, chuyeow wrote: > Ahh thanks for the reply Ben. I actually can get that working for the > home page, no problem, but if I'm understanding you correctly you also > only can get it working for the home page.
If nothing else, it gets you going in the right direction. I like the way it works for my install... when people are looking at a single article, they only see the stuff that's happening in that article.
> I guess I'm looking for something like a 'recent_articles' drop or > 'all_articles | recent: 5' drop + filter.
Rick Olson wrote: > On 9/30/06, chuyeow <chuy...@gmail.com> wrote:
> > Eek so those are new in trunk (I'm still using 0.6). Guess I should try > > and get a trunk deploy going. Thanks.
> > Regarding paging, unless trunk has changed the way articles are > > displayed, wouldn't that mean that if the 'article per page' is set to > > say 10, and you browse a particular section's articles, you would be > > limited to showing only the latest 10 since you can't page further?
> > Thanks for the reply!
> Yup. It's used for searching too.
Wouldn't that be rather restrictive then? How am I going to show my users articles from the, say, 'Mozilla' section past the first 10 articles? Pointing them to the monthly archives is one way but it's not ideal. I'd suggest allowing pagination sometime in the future :)
And also, how do you display monthly archives since you mention it? Is there a drop/filter that would allow me to loop through all the monthly archives I have (skipping over those months for which there are no entries)?
> Rick Olson wrote: > > On 9/30/06, chuyeow <chuy...@gmail.com> wrote:
> > > Eek so those are new in trunk (I'm still using 0.6). Guess I should try > > > and get a trunk deploy going. Thanks.
> > > Regarding paging, unless trunk has changed the way articles are > > > displayed, wouldn't that mean that if the 'article per page' is set to > > > say 10, and you browse a particular section's articles, you would be > > > limited to showing only the latest 10 since you can't page further?
> > > Thanks for the reply!
> > Yup. It's used for searching too.
> Wouldn't that be rather restrictive then? How am I going to show my > users articles from the, say, 'Mozilla' section past the first 10 > articles? Pointing them to the monthly archives is one way but it's not > ideal. I'd suggest allowing pagination sometime in the future :)
I don't like paginated posts. I especially hate doing google searches on something for http://blog/foo/page/2, but finding out that was cached 3 months ago and it's now on page 7. However, /foo/archives/2006/6 never changes. If you really want pagination, write a plugin.
> And also, how do you display monthly archives since you mention it? Is > there a drop/filter that would allow me to loop through all the monthly > archives I have (skipping over those months for which there are no > entries)?