On 18 October 2016 at 18:24, Paul Teehan <paul.tee...@gmail.com> wrote:
> Hello,
> I have 3 sections of posts and on the front page of my site I would like to
> display the most recent n posts (maybe n=5) from each section.
> e.g.:
> Section Foo
> 2016-10-14  Title ...
> 2016-10-15  Title 2 ...
> Section Bar
> 2016-10-13  Title 3 ...
> etc
> I've got the front page displaying one list of all posts.  I don't really
> understand what controls the layout of the front page - I guess it gets a
> list of all posts and displays them using index.tmpl?   I thought about
> trying to filter by section (e.g. if post.section() =="Foo") but apparently
> posts don't have a section attribute.   My best guess is I need to do
> something special to get a custom template for the front page, and do
> something else to get a list of posts for each section?  I'm over my head at
> this point.
> Many thanks
> Paul

That’s not doable with index.tmpl. You could, however, disable/move
those indexes (via conf.py) and create a page using reStructuredText
and post lists:


You could have a page that will end up as /index.html (2nd element in
PAGES = ""; slug = index) and put a post list for every section there.
index.tmpl (and general post indexes) already does some filtering and
stuff and is not feasible for your idea.

PS. you were looking for post.section_name()

Chris Warrick <https://chriswarrick.com/>

You received this message because you are subscribed to the Google Groups 
"nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nikola-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to