Skip to content

Instantly share code, notes, and snippets.

@fmeyer
Created June 11, 2020 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmeyer/aaa5a4fd730bc4eccd52ce2dcdafe042 to your computer and use it in GitHub Desktop.
Save fmeyer/aaa5a4fd730bc4eccd52ce2dcdafe042 to your computer and use it in GitHub Desktop.
<center>
{{ if .IsNamedParams }}
{{- $site := .Get "site" -}}
{{- $name := .Get "name" -}}
{{- $domains := split $site "," -}}
{{- $domains := apply $domains "printf" "site:%s" "." -}}
{{- $domains := delimit $domains " || " -}}
{{- $domains := printf " ( %s )" $domains -}}
<form class="pure-form" role="search" action="https://duckduckgo.com/" onload="this.reset()" onsubmit="this.q.value
= this.query.value + ' ' + this.domains.value;" >
<fieldset>
<input type="text" name="query" class="pure-input-1-2" placeholder="Search on {{ $name }}">
<input type="hidden" name="q">
<input type="hidden" name="kaf" value="1">
<input type="hidden" name="kav" value="1">
<input type="hidden" name="kz" value="1">
<input type="hidden" name="domains" value="{{ $domains }}">
<button type="submit" class="pure-button pure-button-primary">GO</button>
</fieldset>
</form>
{{ else }}
<iframe src="https://duckduckgo.com/search.html?focus=yes" style="overflow:hidden;margin:0;padding:0;width:680px;height:40px;" frameborder="0"></iframe>
{{ end }}

🦆🦆🦆

{{< ddg name="All custom" site="reddit.com,news.ycombinator.com,lobste.rs,stackoverflow.com,stackexchange.com,quora.com">}}

{{< ddg name="Wikipedia" site="en.wikipedia.org">}}

{{< ddg name="Stack*" site="stackoverflow.com,stackexchange.com">}}

{{< ddg name="Reddit, HN, Lobsters" site="news.ycombinator.com,lobste.rs,reddit.com">}}

{{< ddg name="Math" site="math.stackexchange.com,mathworld.wolfram.com,reddit.com/r/math">}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment