Answers.Body: <p>Ended up changing the title to a block within my layout template and doing thus:</p>
  
  <pre><code>{% extends "_layout" %}
  {% set query = craft.request.getParam('q') %}
  {% block title %}Search results for: {{query}}{% endblock %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-24T12:06:58.513Z
Answers.LastActivityDate: 2014-12-24T12:06:58.513Z
Answers.UserDisplayName: Steven Grant
Answers.Body: <p>You should be able to use:</p>
  
  <pre><code>{% set title = "Search results for: " ~ query %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-24T16:25:10.787Z
Answers.LastActivityDate: 2014-12-24T16:25:10.787Z
Answers.UserDisplayName: Steve Abraham
Body: <p>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.</p>
  
  <p>What's the best way to achieve this?</p>
  
  <pre><code>{% extends "_layout" %}
  {% set query = craft.request.getParam('q') %}
  {% set title = "Search results for: {{ query }}" %}
  </code></pre>
  
Tags: <templating><variable>
Title: passing the search query into html title tag
ThreadText: # passing the search query into html title tag
  
  (Asked by: username_0 on 2014-12-24)
  
  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 }}" %}
  
  ```
  
  **Tags:** templating, variable
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-12-24. Score: 5 | Accepted answer
  
  You should be able to use:
  
  ```
  {% set title = "Search results for: " ~ query %}
  
  ```
  
  
  ---
  
  ### Answer by username_0 on 2014-12-24. Score: 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 %}
  
  ```
  
  
  ---
  
  