I followed the Kirby tutorial on building the search, worked like a charm, but now I have a further question:
On my homepage (domain.com/home) I added a search bar. When I enter a keyword it shows me the results on the same page. But what I want to achieve is that whenever I submit the form, it takes the user to a separate search result page with its own template (domain.com/search). How do I pass the query to a different page?
Here is the code so far:
<form> <input type="search" placeholder="Search …" autocomplete="off" name="q" value="<?= html(get('q')) ?>"> <input type="submit" value="Search"> </form> <ul> <?php foreach (page('wiki')->search(get('q'), 'title|text') as $result) : ?> <li> <a href="<?= $result->url() ?>"> <?= $result->title() ?> </a> </li> <?php endforeach ?> </ul>