Clarify installation instructions
This commit is contained in:
54
README.md
54
README.md
@@ -12,35 +12,35 @@ The search plugin should be executed before the pagination plugin (execution ord
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Copy the file `40-PicoSearch.php` to the `plugins` sub-folder of your Pico installation directory. Add a file named
|
* **Copy the file `40-PicoSearch.php` to the `plugins` sub-folder of your Pico installation directory.**
|
||||||
`search.md` to your content root or the sub-folder you want to make searchable. This is your search results page. You
|
* **Add a file named `search.md` to your content root or the sub-folder you want to make searchable.**
|
||||||
can leave it empty of content, but set the `Template` meta tag to a template that loops through the pages and displays
|
This is your search results page. You can leave it empty of content, but set the `Template` meta tag to a template
|
||||||
them. Your `search.md` might look like this:
|
that loops through the pages and displays them. Your `search.md` might look like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
/*
|
/*
|
||||||
Title: Search results
|
Title: Search results
|
||||||
Template: search
|
Template: search
|
||||||
*/
|
*/
|
||||||
```
|
```
|
||||||
|
* **Add a template file with the name defined in `search.md`.**
|
||||||
|
Your template file (`search.html` in the above example) should contain something like the following section, which
|
||||||
|
lists the pages matching the search (substitute `paged_pages` for `pages` if using Pico-Pagination):
|
||||||
|
|
||||||
Your template file (`search.html` in the above example) should contain something like the following section, which
|
```twig
|
||||||
lists the pages matching the search (substitute `paged_pages` for `pages` if using Pico-Pagination):
|
<div class="SearchResults">
|
||||||
|
{% if pages %}
|
||||||
```twig
|
{% for page in pages %}
|
||||||
<div class="SearchResults">
|
<div class="SearchResult">
|
||||||
{% if pages %}
|
<h2><a href="{{ page.url }}">{{ page.title }}</a></h2>
|
||||||
{% for page in pages %}
|
{% if page.description %}<p>{{ page.description }}</p>{% endif %}
|
||||||
<div class="SearchResult">
|
</div>
|
||||||
<h2><a href="{{ page.url }}">{{ page.title }}</a></h2>
|
{% endfor %}
|
||||||
{% if page.description %}<p>{{ page.description }}</p>{% endif %}
|
{% else %}
|
||||||
</div>
|
<p>No results found.</p>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
{% else %}
|
</div>
|
||||||
<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
|
||||||
in a sub-folder) and see the search results for "foobar" listed.
|
in a sub-folder) and see the search results for "foobar" listed.
|
||||||
|
|||||||
Reference in New Issue
Block a user