passing the search query into html title tag 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 }}" %}
You should be able to use:

{% set title = "Search results for: " ~ query %}