---
title: Simple Site Search
description: How to make a Google Site Search like deno.com
keywords: site search, google, html, form
date: 2025, 01, 21
---

![YouTube Walkthrough](yt:mXqKLlzRmcM)

## Google site search

I recently learned by using the site search on [deno.com](https://deno.com) that you can search specific sites on Google by including `site:example.com` in your search. For example, I can search for the term "html" on my blog with this search entry.

`html site:int.pub`

Their implementation is very simple and can be used on any indexed site. Here's how you can implement a simple search feature on your site using an HTML form.

## Zero JavaScript site search

Create an HTML form that performs a `get` request to google.com/search. The `<form>` will have two `<input>` elements that have `name=q` attributes. The first will be input for the user's search, and the second will be a hidden input with the `value` attribute set to `"site:..."` - the site you want to search. These will be used by the browser to create the URL string.

```html
<form action="https://google.com/search">
	<input type="search" name="q" placeholder="Search int.pub" />
	<input type="hidden" name="q" value="site:int.pub" />
</form>
```

For example, when you search for "html", the form would create a `get` request to:

https://www.google.com/search?q=html&q=site%3Aint.pub

You can try it out below:

<form action="https://google.com/search" class="flex gap-4">
	<input type="search" name="q" placeholder="Search int.pub" />
	<input type="hidden" name="q" value="site:int.pub" />
</form>

## Indexed pages only

If you have pages that are not indexed on Google, they will not appear in the search. Be sure to register your site on the Google Search Console to ensure it gets indexed properly. Pages that exist behind authentication will not be able to be searched using this method.

Thanks for reading!
