Update search results example in README.md

This commit is contained in:
Pontus Horn af Rantzien
2016-11-13 22:20:01 +01:00
committed by GitHub
parent c0711ec72c
commit 09597fa838

View File

@@ -28,14 +28,18 @@ 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): lists the pages matching the search (substitute `paged_pages` for `pages` if using Pico-Pagination):
```twig ```twig
{% if pages %} <div class="SearchResults">
{% if pages %}
{% for page in pages %} {% for page in pages %}
<div class="search_result"> <div class="SearchResult">
<h2><a href="{{ page.url }}">{{ page.title }}</a></h2> <h2><a href="{{ page.url }}">{{ page.title }}</a></h2>
{% if page.description %}<p>{{ page.description }}</p>{% endif %} {% if page.description %}<p>{{ page.description }}</p>{% endif %}
</div> </div>
{% endfor %} {% endfor %}
{% endif %} {% else %}
<p>No results found.</p>
{% endif %}
</div>
``` ```
Now, you should be able to visit for example `yoursite.com/search/foobar` (adjust path accordingly if putting search.md Now, you should be able to visit for example `yoursite.com/search/foobar` (adjust path accordingly if putting search.md