How do I limit search results to current topic?

Last Updated -

Option 1 – Always limit search to current topic

  1. Go to Desk Admin
  2. At the top, go to Channels
  3. On the left, go to Support Center → Web Themes
  4. Click the title of the web theme with a blue Default tag
  5. At the top, click into Advanced Themes
  6. On the left, click into Layout
  7. Find this line of code: {{template_form_params}}
  8. Add this right below it:
    {% if topic.id %}<input name='kb_topic_ids' type='hidden' value='{{ topic.id }}' />{% endif %}

Option 2 – Add a topic dropdown to search

  1. Go to Desk Admin
  2. At the top, go to Channels
  3. On the left, go to Support Center → Web Themes
  4. Click the title of the web theme with a blue Default tag
  5. At the top, click into Advanced Themes
  6. On the left, click into Layout
  7. Find this line of code: <input type='submit' id='support-search-submit' value='{{system.snippets.search}}' />
  8. Add this right below it:
          <select name="kb_topic_ids" style="position: absolute; top: 5px; right: 132px;">
              <option value="">All Topics</option>
            {% for ct in site.topics %}
              <option value="{{ ct.id }}">{{ ct.name }}</option>
            {% endfor %}
          </select>