From b7227271f1bf41126eb4b3c17a449c79d75c7cf4 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 27 Dec 2016 14:19:14 +0700 Subject: [PATCH] Page one pagination should link to "/" not "/?p=1" --- lib/nunjucks-filters.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/nunjucks-filters.js b/lib/nunjucks-filters.js index 578a5a8..cf4aade 100644 --- a/lib/nunjucks-filters.js +++ b/lib/nunjucks-filters.js @@ -50,8 +50,12 @@ const filters = { query.p--; } + // Don't add p var if it's page 1 + query.p == 1 && delete query.p + // Encode query string - return `/?${querystring.encode(query)}`; + const queryString = querystring.encode(query); + return queryString ? `/?${queryString}` : '/'; }, name: node => node.nickname || node.fingerprint && node.fingerprint.slice(0, 8)