# Search box in custom (404) page

**URL:** https://meta.discourse.org/t/search-box-in-custom-404-page/48292
**Category:** Development
**Created:** [8월 6, 2016, 12:18오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292 "2016-08-06T12:18:39Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [8월 6, 2016, 12:18오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/1 "2016-08-06T12:18:39Z")

</div>

Hello,

is it possible to add somehow visible prominent search box to custom e.g. 404 page? I see there is google search now, but I would like to replace it with internal site search. Is there any reason why offer google box there instead of internal search?

I’d just like to hack a box with GO button which will redirect to full page search results.

Thanks for input…

I’ve found this code for Handlebars.. using component `search-text-field.js.es6`

> ```
> <div class="search row clearfix">
> {{search-text-field value=searchTerm class="full-page-search input-xxlarge search no-blur" action="search" hasAutofocus=hasAutofocus}}
> {{d-button action="search" icon="search" class="btn-primary" disabled=searchButtonDisabled}}
> </div>
> 
> ```

Seems like this should be pretty easy.. After placing this into custom template, the only thing that seems to be missing is “search” action defined on template’s controller which will redirect the search into full page search… Any clues?

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [8월 13, 2016, 1:42오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/2 "2016-08-13T13:42:41Z")

</div>

Is there any simple way to put search text field to some other page than full page search? Thanks in advance.

[update]Simplest way I’ve found is to use `{{search-text-field}}` component in custom handlebars template and then define search action on controller:

```
import DiscourseURL from 'discourse/lib/url';

export default Ember.Controller.extend({
  
  actions: {
    search() {
      let searchTerm = this.get('searchTerm');
      DiscourseURL.routeTo('/search?q=' + searchTerm); 
    }
  }
});

```

Is there any way to modify default text (search topics, posts, users or categories):

![](https://global.discourse-cdn.com/meta/original/3X/5/f/5fe751a3314d445cdb4da8ea7c94f5c49d506214.png)

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [8월 13, 2016, 2:41오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/3 "2016-08-13T14:41:14Z")

</div>

> [@Overgrow](#):
>
> I see there is google search now, but I would like to replace it with internal site search. Is there any reason why offer google box there instead of internal search?

I think this was mainly left over from a time when internal site search was not nearly as good as it is now.

Internal search would be a better default here now, IMHO. Especially for sites that are not public 🙂

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [8월 13, 2016, 2:58오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/4 "2016-08-13T14:58:05Z")

</div>

Exactly… I see the power of search filtering (in:wiki, …) as killer feature in Discourse… I’d absolutely agree with using internal search whenever possible.

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [11월 7, 2016, 9:08오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/5 "2016-11-07T21:08:53Z")

</div>

After some time I still wonder if internal search (instead of google search) could or should be included in custom 404 - not found - page… What are your opinions..?

I like sites that extract sensible text from requested url and prefill search query box with it… Currently this is done in google search box and only for /t/ links so this could be improved strongly.. What is your opinion about extending it to all types of urls…?

---

<div class="post-metadata">

### Author: ![nmagee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nmagee/32/119531_2.png) [@nmagee](https://meta.discourse.org/u/nmagee)
#### Post date: [5월 25, 2017, 2:40오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/6 "2017-05-25T14:40:44Z")

</div>

I’m seeing this topic now – only because I just bumped into the “Google” search box on the 404 page, which no longer makes sense now (especially for our site which is private behind an SSO provider and not visible to Google).

I would vote for moving to the regular internal search.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5월 25, 2017, 9:49오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/7 "2017-05-25T21:49:46Z")

</div>

If your site is login required that search should be disabled, follow up with @techAPJ

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [5월 26, 2017, 6:29오전 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/8 "2017-05-26T06:29:07Z")

</div>

> [@codinghorror](#):
>
> If your site is login required that search should be disabled

I can confirm this. This change was made ~3 years ago.

[https://github.com/discourse/discourse/commit/a597f1fa3021f0190adef81fd553439810ccb8fd](https://github.com/discourse/discourse/commit/a597f1fa3021f0190adef81fd553439810ccb8fd)

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [5월 26, 2017, 7:23오전 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/11 "2017-05-26T07:23:10Z")

</div>

Any chance google search could be replaced by internal search? Internal search is very powerful imho and you can loose visitors via google search.

---

<div class="post-metadata">

### Author: ![nmagee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nmagee/32/119531_2.png) [@nmagee](https://meta.discourse.org/u/nmagee)
#### Post date: [5월 26, 2017, 4:51오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/12 "2017-05-26T16:51:01Z")

</div>

@techAPJ Our Discourse has `login_required` checked in the settings, with SSO enabled, and yet if I go to a fictitious page to trigger the 404, I get this with Google search intact. We are running 1.8.0.beta12+60

 ![](https://global.discourse-cdn.com/meta/original/3X/3/f/3f95ca8d72a7235d35f1aa0721be5895a6b797f0.png)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5월 26, 2017, 4:53오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/13 "2017-05-26T16:53:23Z")

</div>

Yes that seems like a bug @techapj can you verify?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [5월 26, 2017, 5:03오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/14 "2017-05-26T17:03:33Z")

</div>

I am not able to repro this with `login required` (and SSO) enabled locally or on a hosted instance. Can you PM me the URL of your forum so that I can look into it?

---

<div class="post-metadata">

### Author: ![positivejam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/positivejam/32/120138_2.png) [@positivejam](https://meta.discourse.org/u/positivejam)
#### Post date: [4월 7, 2018, 7:00오후 UTC](https://meta.discourse.org/t/search-box-in-custom-404-page/48292/15 "2018-04-07T19:00:26Z")

</div>

@Overgrow and @nmagee, did you ever get this solved? I’m also getting a Google search box on my 404 page on a site with login required and SSO enabled. Curious what you might have ended up doing to fix.
