DuckDuckGo Search Suggestions

Solves Is there a way to suggest DuckDuckGo instead of Google for failed search UI?.

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.

18 лайков

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?

2 лайка

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

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

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.

2 лайка

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!

1 лайк

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

5 лайков

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?

1 лайк

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…

Given

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.

3 лайка

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.

6 лайков

Есть ли какая-то причина, по которой Google по-прежнему является поиском по умолчанию в Discourse при расширенном поиске? DuckDuckGo больше соответствует духу Discourse, чем Google.

4 лайка

Поддерживаю, есть ли сейчас обходной путь?

Можно было бы использовать и с Discourse AI тоже :slight_smile:

1 лайк

Этот компонент темы и есть обходное решение.

3 лайка

Я не видел эту тему и не знал о компоненте темы, поэтому просто полностью убрал весь функционал поиска в Google… Однако мне не хочется добавлять ещё один неофициальный компонент темы. Было бы здорово, если бы по умолчанию использовался DuckDuckGo или если бы существовала настройка сайта.

1 лайк

…которая позволяла бы изменить провайдера или вообще убрать эту подсказку поиска.

А пока, как именно вам удалось «полностью убрать функцию поиска»? Предполагаю, вы создали компонент темы, но можете ли вы поделиться здесь самим кодом (чтобы мне не пришлось разбираться в этом самостоятельно)?

Я сделал форк и изменил URL. Общий стандарт должен заключаться в том, чтобы оставлять поле пустым и позволять пользователю изменять его.

Именно так работает маркетинг в своей глубине — через социальную инженерию на тончайших уровнях.

Я выкатил обновление для использования плагинного выхода, но для этого необходимо добавить выход в сам Discourse.

7 лайков