Closed dussaxi closed 6 years ago
Ok I finally got it to work. I share my findings here. It was all about the route and a missing results page. My structre is like this: 01,blog -->blog.md 04.books -->books.md -->book1 ---->book.md ..
in my simplesearch.yaml I have:
route: /search
search_content: rendered
template: mysearch_results
filters:
filter_combinator: or
my blog.md looks something like:
title: Blog
content:
items: '@self.children'
order:
by: date
dir: desc
limit: 5
pagination: true
pagination: true
simplesearch:
route: /search
filters:
- @self
filter_combinator: and
my books.md looks like this:
title: Books
content:
items: '@self.children'
order:
by: date
dir: desc
limit: 20
pagination: true
pagination: true
simplesearch:
route: /search
filters:
- @self
filter_combinator: and
in both, my blog.html.twig and books.html.twig I include the sidebar with:
{% include 'partials/sidebar.html.twig' with {'page':page} %}
!!Attention: In this two files I have to delete the change of the base_url, which was:
{% set base_url = page.url %}
This line caused the problem on the books.md. page, so the search result never was shown.
in the sidebar.html.twig the searchbox is included with this command lines:
```
{% set new_base_url = page.url == '/' ? '' : page.url %} {% if config.plugins.simplesearch.enabled %}
{% endif %}
and the simplesearch_searchbox.html.twig remains unchanged.
Good luck
I can't get page based search to work. Any help? I have a page with two collection pages:
01.blog -> blog.md -> /blog1 ...etc. 02.books -> books.md -> /book1 ... etc.
I want to add a search-box on both of these collection pages. Each of the search-box shall only search the sites beneath the collection site they are on.
Any help what I have to put in the yaml file and the page frontmatter to get this to work?