From 62a7111643df6ec918fbbf5a29e2439aadd7f3a7 Mon Sep 17 00:00:00 2001 From: Christian Becher Date: Wed, 9 Nov 2016 08:43:20 +0100 Subject: [PATCH] Updated code example for results page Otherwise, if no results found, twig produces an error message that breaks down the whole website/page. --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c4b5d15..78e798a 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,14 @@ Your template file (`search.html` in the above example) should contain something lists the pages matching the search (substitute `paged_pages` for `pages` if using Pico-Pagination): ```twig -{% for page in pages %} -
-

{{ page.title }}

- {% if page.description %}

{{ page.description }}

{% endif %} -
-{% endfor %} +{% if pages %} + {% for page in pages %} +
+

{{ page.title }}

+ {% if page.description %}

{{ page.description }}

{% endif %} +
+ {% endfor %} +{% endif %} ``` Now, you should be able to visit for example `yoursite.com/search/foobar` (adjust path accordingly if putting search.md