I am trying to set up a blog and portfolio page with multiple child items that i can search within each section. but i am having an issue that when i enable simple search and add route to the page header all of the content disappears.
so i have set up a blog page with child items within the main file blog.md i have included
content:
items: '@self.children'
limit: 6
order:
by: date
dir: desc
pagination: true
url_taxonomy_filters: true
simplesearch:
route: /blog
filters:
- @self
- @taxonomy: [tag]
filter_combinator: and
and then in the blog.html.twig file i have added
{% include 'partials/simplesearch_searchbox.html.twig' %}
the plugin is enabled so i was hoping things would work, but when i load the page
i can only see the search box and none of the blog posts are displayed.
if i search for something it does display a results page from only the blog section, which i want.
if i remove the route: /blog in the header, all of my blog posts return and if i search, it searches the whole site.
i am wondering if when adding route: /blog to the header it is using the simplesearch_results.html.twig template and it overwrites my {% block content %} tag as when i look at the code it only has the search bar content
html of page
<article class="magic-content prose md:prose-md max-w-none">
<div class="content-padding simplesearch">
<h1 class="search-header">Search Results</h1>
<div class="center">
<div class="search-wrapper relative" x-data="simpleSearchData({ query: '', autocomplete: 0, url: '/news.json/query', separator: ':' })">
<form name="search" action="/news" data-simplesearch-form="">
<input x-ref="query" x-model="query" @focus="search($event, $dispatch)" @input="search($event, $dispatch)" name="query" class="search-input" type="text" min="3" required="" placeholder="Search …" value="" data-search-invalid="Please add at least 3 characters">
</form>
</div>
</div>
<p></p>
</div>
</article>
simplesearch_results.html.twig
{% block content %}
<div class="content-padding simplesearch">
<h1 class="search-header">{{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS"|t }}</h1>
<div class="center">
{% include 'partials/simplesearch_searchbox.html.twig' %}
</div>
<p>
{% if query %}
{% set count = search_results ? search_results.count : 0 %}
{% if count is same as( 1 ) %}
{{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_SINGULAR"|t(query|e)|raw }}
{% else %}
{{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_PLURAL"|t(query|e, count)|raw }}
{% endif %}
{% endif %}
</p>
{% for page in search_results %}
{% include 'partials/simplesearch_item.html.twig' with {'page': page} %}
{% endfor %}
</div>
{% endblock %}
part of my portfolio twig file
{% embed 'partials/base.html.twig' %}
{% set show_breadcrumbs = theme_var('show_breadcrumbs', true)|e %}
{% set collection = page.collection() %}
{% block content %}
{{ page.content }}
{% include 'partials/simplesearch_searchbox.html.twig' %}
{% include 'partials/taxonomyfilter.html.twig' with {'base_url':portfolio, 'taxonomy':'tag'} %}
<section class="mt-16" id="portfolio">
<div >
<div class="grid grid-cols-1 gap-16 lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 portfolio-main-posts">
{% for child in collection %}
{% include 'partials/portfolio_item.html.twig' with {'blog': page, 'page': child, 'truncate': true} %}
{% endfor %}
</div>
so am i doing something wrong or is there something i can change to display all results?