Protect tntsearch results page (require login)

Hi!
I’ve installed tntsearch and would like to protect the /search page requiring the user to login before he can make any search.

I’m using the learn2 skeleton witch already uses the login plugin.

Already tried adding this to the tntsearch.html.twig partial:

---
access:
    site.login: true
---

And also tried adding this to the tntsearch.yaml file:

access:
    site.login: true

None of them worked.

Can anyone help with some tip?

You are close to the solution. The trick is not to add:

---
access:
    site.login: true
---

to the Twig template but to the page header or frontmatter of the /search page instead.

You may have to create that page if I understand the docs correctly.

Thank you, it worked.

But I think since I’m editing a plugin file (user/plugins/tntsearch/pages/search.md) it could be overwritten in a future update of the tntsearch plugin. The perfect solution would be one that can continue to work when the plugin is updated.

In Customizing the Search Page it is stated that the plugin uses the search page it provides if there is no physical Grav page at the search path route. So, I assume that when you copy the plugin’s search page and make that accesible through the (configured?) search route you are set.

Ah thank you! I didn’t notice that!