# DuckDuckGo Search Suggestions

**URL:** https://meta.discourse.org/t/duckduckgo-search-suggestions/83902
**Category:** Theme component
**Created:** [March 26, 2018, 8:13pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902 "2018-03-26T20:13:20Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![notriddle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/notriddle/32/133055_2.png) [@notriddle](https://meta.discourse.org/u/notriddle)
#### Post date: [March 26, 2018, 8:13pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/1 "2018-03-26T20:13:20Z")

</div>

> **[GitHub - notriddle/discourse-duckduckgo-search: A theme component to use DuckDuckGo as the...](https://github.com/notriddle/discourse-duckduckgo-search)**
>
> A theme component to use DuckDuckGo as the suggested search engine when there are no results

Solves [Is there a way to suggest DuckDuckGo instead of Google for failed search UI?](https://meta.discourse.org/t/is-there-a-way-to-suggest-duckduckgo-instead-of-google-for-failed-search-ui/83895).

A Discourse theme component to use DuckDuckGo as the suggested search system, instead of Google!

p.s. You’ll probably want to customize some of the text strings to stop mentioning Google, too.

---

<div class="post-metadata">

### Author: ![wolftune](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wolftune/32/103569_2.png) [@wolftune](https://meta.discourse.org/u/wolftune)
#### Post date: [March 27, 2018, 7:45pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/5 "2018-03-27T19:45:25Z")

</div>

Here’s what I’ve noted to be the places to alter the text:

- js.search.or\_search\_google
- js.search.search\_google
- js.search.search\_google\_button
- page\_not\_found.search\_google
  - _ **is that search also adjusted to DDG in the theme? If not, that should be fixed too** _

- js.google\_search
  - that looks like it’s editable to put in DDG directly, not sure how that’s related

Is that it?

---

<div class="post-metadata">

### Author: ![notriddle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/notriddle/32/133055_2.png) [@notriddle](https://meta.discourse.org/u/notriddle)
#### Post date: [March 27, 2018, 9:33pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/6 "2018-03-27T21:33:03Z")

</div>

> [@wolftune](#):
>
> is that search also adjusted to DDG in the theme? If not, that should be fixed too

Okay, I’m writing this down, because 404 handling in Discourse is _weird_. Try this link on for size:

[https://meta.discourse.org/nonexistant-page](https://meta.discourse.org/nonexistant-page)

If you open it in a new tab, you’ll notice that your user menu (the one in the upper-right of the page) doesn’t render. In fact, the Discourse Ember app doesn’t get loaded at all in this case. It’s being rendered by the Rails server following [`app/views/exceptions/not_found.html.erb`](https://github.com/discourse/discourse/blob/master/app/views/exceptions/not_found.html.erb)

Obviously, if you click the link directly in this page, the Ember app remains resident. Try hitting the link with a `.json` at the end, and instead of sending the app a full 404 page, it sends an HTML fragment, with the heading and stuff removed, which the Ember app just plops into place.

---

<div class="post-metadata">

### Author: ![wolftune](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wolftune/32/103569_2.png) [@wolftune](https://meta.discourse.org/u/wolftune)
#### Post date: [March 27, 2018, 9:55pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/7 "2018-03-27T21:55:26Z")

</div>

Oh weird. But if that’s less trivial to fix, at least it can be documented and the easier parts all fixed. Thanks for working on this!

---

<div class="post-metadata">

### Author: ![notriddle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/notriddle/32/133055_2.png) [@notriddle](https://meta.discourse.org/u/notriddle)
#### Post date: [March 27, 2018, 10:37pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/8 "2018-03-27T22:37:29Z")

</div>

[https://github.com/notriddle/discourse-duckduckgo-search/commit/17c849c5b8c22476720a07ee7ebfa4536feecedc](https://github.com/notriddle/discourse-duckduckgo-search/commit/17c849c5b8c22476720a07ee7ebfa4536feecedc)

Added a commit to do the form rewriting to make the 404 page work, both within and without the Ember app.

---

<div class="post-metadata">

### Author: ![wolftune](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wolftune/32/103569_2.png) [@wolftune](https://meta.discourse.org/u/wolftune)
#### Post date: [March 28, 2018, 8:08pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/9 "2018-03-28T20:08:40Z")

</div>

Great! So the only remaining thing is to document (probably both here and at the repo README) the confirmed list of text items theme-users will need to customize in the admin UI?

---

<div class="post-metadata">

### Author: ![wolftune](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wolftune/32/103569_2.png) [@wolftune](https://meta.discourse.org/u/wolftune)
#### Post date: [April 2, 2018, 1:29am UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/10 "2018-04-02T01:29:29Z")

</div>

I got this working, but it’s a little strange to have the page-not-found version start with the form using ` site:xxx…` with no search term alongside that. Maybe that’s as good as it gets, but it would be ideal if it were feasible to get the text of the URL after the TLD for the not-found page and use that as the default search before the site: part…

---

<div class="post-metadata">

### Author: ![wolftune](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wolftune/32/103569_2.png) [@wolftune](https://meta.discourse.org/u/wolftune)
#### Post date: [October 16, 2018, 3:15am UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/11 "2018-10-16T03:15:08Z")

</div>

Given

> [@Replace Google search with Discourse search on not found page](https://meta.discourse.org/t/replace-google-search-with-discourse-search-on-not-found-page/33189/13):
>
> And … this is done now slight_smile Thanks @misaka4e21!

Google is no longer used at 404 pages. So, this theme probably needs updating to leave 404 pages alone, let them be the regular internal search as is now standard.

Discourse is still using Google for extra searching when internal searches fail though. So, for that, this DDG option still applies.

---

<div class="post-metadata">

### Author: ![notriddle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/notriddle/32/133055_2.png) [@notriddle](https://meta.discourse.org/u/notriddle)
#### Post date: [December 9, 2018, 12:34am UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/12 "2018-12-09T00:34:34Z")

</div>

It wasn’t actually breaking anything, but I did go ahead and revert it. It also made the code simpler, since I can just replace the template again.

[https://github.com/notriddle/discourse-duckduckgo-search/commit/39e5501c35f2b73dd3eb9a7977de0c472d85711c](https://github.com/notriddle/discourse-duckduckgo-search/commit/39e5501c35f2b73dd3eb9a7977de0c472d85711c)

---

<div class="post-metadata">

### Author: ![Zup](https://avatars.discourse-cdn.com/v4/letter/z/c37758/32.png) [@Zup](https://meta.discourse.org/u/Zup)
#### Post date: [March 19, 2021, 11:59pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/13 "2021-03-19T23:59:10Z")

</div>

is there any reason Google is still the default for Discourse when extra searching occurs? DuckDuckGo is more in tune with the mindset of Discourse than Google is.

---

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [August 14, 2023, 11:00pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/14 "2023-08-14T23:00:52Z")

</div>

I second this, there is a current workaround?

Could be used with Discourse AI too 🙂

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [August 14, 2023, 11:35pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/15 "2023-08-14T23:35:10Z")

</div>

This theme component _is_ the workaround.

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [August 14, 2023, 11:45pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/16 "2023-08-14T23:45:08Z")

</div>

I hadn’t seen this topic and didn’t know about the theme component, so I just got rid of the whole Google search thing entirely… I’m reluctant to add yet another unofficial theme component now though. It would be good if the default were DuckDuckGo or if there were a site setting.

---

<div class="post-metadata">

### Author: ![mdoggydog](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@mdoggydog](https://meta.discourse.org/u/mdoggydog)
#### Post date: [January 24, 2025, 11:12pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/17 "2025-01-24T23:12:06Z")

</div>

> [@Jonathan5](#):
>
> It would be good if the default were DuckDuckGo or if there were a site setting.

…that allowed changing the provider, or removing this fallback search suggestion altogether.

In the meantime, how _did_ you “remove the search thing entirely”? Presumably, you made a theme component, but can you share the actual code here (so I don’t have to go figure this out myself)?

---

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [January 25, 2025, 12:35am UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/18 "2025-01-25T00:35:48Z")

</div>

> [@Jonathan5](#):
>
> It would be good if the default were DuckDuckGo or if there were a site setting.

I forked it and changed the URL. The general standard should be to leave it empty and allow the user to change it.

That’s how marketing deeply works, through social engineering on finest levels.

---

<div class="post-metadata">

### Author: ![notriddle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/notriddle/32/133055_2.png) [@notriddle](https://meta.discourse.org/u/notriddle)
#### Post date: [March 10, 2025, 7:52pm UTC](https://meta.discourse.org/t/duckduckgo-search-suggestions/83902/19 "2025-03-10T19:52:48Z")

</div>

I’ve pushed an update to use a [plugin outlet](https://meta.discourse.org/t/removing-support-for-template-overrides-and-mobile-specific-templates/355668/5), but this needs the outlet added to Discourse itself.

[https://github.com/discourse/discourse/pull/31733](https://github.com/discourse/discourse/pull/31733)
