Hello.
I am porting a site from Hugo to Zola. I am thus writing a cut down, much simpler version of the theme I used with only the features I need. I have come across a problem with the pagination and was wondering if what I am trying to do is simply not supported.
The site I have is a simple blog. I have posts. I have an about page. And that’s about it. The behavior of the site is the following:
- if you go to
www.mysite.com
, you get a paginated list of the blog entries/posts, 5 at a time. - if you go to
www.mysite.com/posts/#
, where # is some number > 0, you get a paginated list of the blog entries/posts, 5 at a time. - if you go to
www.mysite.com/posts
, (notice, no numbers) you get a view of the ALL posts, grouped by year - otherwise, you are on a page with an actual post and reading it.
Fairly straight forward I think. I got this to mostly work using a transparent ‘posts’ sections, which allows the main content section to have all the posts, and a paginated ‘main section’ which then paginates those posts. Here is the directory structure I use:
project/content/_index.md -> paginate_by = 5
/posts/_index.md -> transparent = true
some_post.md
some_other_post.md
...
/about.md
/templates/base.html
about.html
index.html -> used by the main "content" section, paginates
post.html -> used by the posts section, groups by year
post-page.html
It works rather well except for one thing: the about page. That page is now an “entry” in the pagination, since it is (unsurprisingly) captured/included by the paginator as a page of the main section.
I was wondering if there is a way to exclude a page from the paginator. The thing is, I could probably relatively easily filter it out via the title, but the pagination logic would become more complicated. Imagine there are 10 blog entries and, as mentioned, I paginate by groups of 5. Then, on the second paginator, even though technically, 10 posts have been processed and there are no more posts, the paginator object would still have a next because the about page is the eleventh one. It becomes difficult to know if I should put the “more entries” link or not. Other than using the title to filter out the about page, I was also thinking I could use a supplemental transparent content level maybe (one level of indirection is always the solution… ), but I believe (untested, maybe I am completely wrong) that that would make the links/permalinks/slugs wrong somehow.
Anyhow, if someone has any idea on how I could achieve what I want simply, I would appreciate it.
And as I have seen someone say it before, kudos to the person/team for the work on Zola. I got to where I am in a fairly minimal amount of time. The concepts are not overwhelming and even though the documentation is not perfect, it is very helpful and the concepts are intuitive enough that you can get results in a very reasonable amount of time. So thanks!