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)