Adding Search to Jekyll

November 16, 2018

I wanted to add a simple search functionality to my blog that didn’t require a lot of time or work. There are a lot of options (paid and free) out there, but I decided to go with a simple DuckDuckGo integration. I like their search engine and what they stand for as a company.

DuckDuckGo does offer a simple way to add a search box to your site using an iframe, but I wanted something even more basic. So I threw this together.

<div class="search">
 	<form class="ddg" name="x" action="//duckduckgo.com/">
		<input type="hidden" value="https://www.mattlangford.net" name="sites">
		<input type="hidden" value="1" name="kh">
  		<input type="hidden" value="1" name="kn">
		<input type="hidden" value="1" name="kac">
		<input type="text" class="search" name="q" placeholder="search term">
		<button type="submit">Search</button>
  	</form>
</div>

Feel free to use on your site as you wish, just make sure to change my domain name to yours. Of course, you’ll need to style it up as well.