diff options
-rw-r--r-- | man/blogc-make.1.ronn | 3 | ||||
-rw-r--r-- | src/blogc-make/rules.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/man/blogc-make.1.ronn b/man/blogc-make.1.ronn index 6d5552b..ca9c4da 100644 --- a/man/blogc-make.1.ronn +++ b/man/blogc-make.1.ronn @@ -89,7 +89,8 @@ The rule passes the following helper variables to blogc(1): ### pagination -Build pagination pages from posts. +Build pagination pages from posts. This rule will be disabled if +`posts_per_page` is negative or `0` in blogcfile(5). The rule passes the following helper variables to blogc(1): diff --git a/src/blogc-make/rules.c b/src/blogc-make/rules.c index d8614b6..79d722a 100644 --- a/src/blogc-make/rules.c +++ b/src/blogc-make/rules.c @@ -228,6 +228,9 @@ pagination_outputlist(bm_ctx_t *ctx) long posts_per_page = strtol( bc_trie_lookup(ctx->settings->settings, "posts_per_page"), NULL, 10); // FIXME: improve + if (posts_per_page <= 0) + return NULL; + size_t pages = ceilf(((float) num_posts) / posts_per_page); const char *pagination_prefix = bc_trie_lookup(ctx->settings->settings, |