隨著網站資料量增長,自建搜尋引擎成本高昂。若網站內容已被 Google 大量收錄,直接使用 Google 站內搜尋(site: 限制)即可零成本獲得優質搜尋體驗。
<form id="search-form" action="https://www.google.com/search" method="get">
<input type="hidden" name="sitesearch" value="example.com" />
<input type="text" name="q" placeholder="搜尋..." />
<input type="submit" value="搜尋" />
</form>
| 參數名 | 用途 | 範例值 |
|---|---|---|
sitesearch | 限定搜尋網域(等同 site:example.com) | example.com |
q | 使用者輸入的關鍵字 | 關鍵字 |
ie | 輸入編碼(預設 UTF-8) | UTF-8 |
oe | 輸出編碼(預設 UTF-8) | UTF-8 |
hl | 介面語言 | zh-TW, zh-CN, en |