1

I wish to show the search query inside the page template but my logic seems to be off and just shows {{ query }} as a string.

What's the best way to achieve this?

{% extends "_layout" %}
{% set query = craft.request.getParam('q') %}
{% set title = "Search results for: {{ query }}" %}
5

You should be able to use:

{% set title = "Search results for: " ~ query %}
| improve this answer | |
1

Ended up changing the title to a block within my layout template and doing thus:

{% extends "_layout" %}
{% set query = craft.request.getParam('q') %}
{% block title %}Search results for: {{query}}{% endblock %}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.