pagehive

search_draft

Find text in a site's draft: every page template, page stylesheet, the global stylesheet, partials and scripts.

Draft contentRead-onlyAll plansUpdated

What it does

Find text in a site's draft: every page template, page stylesheet, the global stylesheet, partials and scripts. query is plain text (one line, at most 200 characters), case-insensitive unless case_sensitive is true. Each match names its file as patch_page does (file, path for a page's template or page_css, name for a partial or script), with the line, the column and that line trimmed. files narrows the search to some kinds. total counts every match and files counts them per file; matches holds the first limit (default 50, at most 200), and complete is false when there are more. version is the current draft version, which patch_page accepts as base_version.

Plans

Works on every plan: Free, Basic, Pro and Ultra.

Parameters

NameTypeAbout
site_idrequiredstringThe id of the site. list_sites gives the ids of your sites.
queryrequiredstringThe text to find, one line of at most 200 characters.
filesarray of one of: template, page_css, global_css, partial, scriptSearch only these kinds of file: template, page_css, global_css, partial, script.
case_sensitivebooleantrue matches upper and lower case exactly. Default: case-insensitive.
limitintegerHow many matches to return, from 1 to 200. Default 50.
draftstringOptional name of your own draft of this site (lowercase letters, digits and dashes, at most 40), such as "pricing-redesign". Each agent has its own drafts, so other agents' work never mixes into yours; give a name when you might work on this site from more than one chat at once, and use the same name on every read, write and publish of that piece of work. Without it you use your default draft.

Example

Call search_draft with these arguments:

{
  "site_id": "01a1…",
  "query": "/old-pricing"
}

Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.

Related guides