Skip to content
Browse files

Merge pull request #1 from rudyrigot/no_empty_q

Avoiding to send empty q parameters
  • Loading branch information...
2 parents 784c7e6 + 12ba8c8 commit 6c4e89c921dea8bd4f379e9dfdf268d20a79ec6a @guillaumebort guillaumebort committed Dec 6, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 routes/blog.js
View
6 routes/blog.js
@@ -15,7 +15,11 @@ exports.posts = prismic.route(function(req, res, ctx) {
var category = req.params['category'];
- ctx.api.form('blog').ref(ctx.ref).query(category ? '[[:d = at(my.blog-post.category, "' + category + '")]]' : '').submit(function(posts) {
+ var searchForm = ctx.api.form('blog').ref(ctx.ref);
+
+ if (category) searchForm.query('[[:d = at(my.blog-post.category, "' + category + '")]]');
+
+ searchForm.submit(function(posts) {
res.render('posts', {
posts: posts,

0 comments on commit 6c4e89c

Please sign in to comment.
Something went wrong with that request. Please try again.