# Site Search

## Site Search

**Files:** `src/content/sections/<language>/search-list.md`, `src/layouts/components/sections/search/SearchList.astro` · **Skill level:** Beginner

Covena has a search page at `/search/` (and `/fr/search/`, `/ar/search/`). A visitor types a word or two, such as "will" or "Manchester", and the list below the field shows the pages that contain every word. It works in the browser with no search service, no index to build, and no account.

### What It Searches
When the site builds, the search page gets one row for each:

| Kind | Row text |
| --- | --- |
| Practice area | title and `description` |
| Attorney | name, `role`, and `introBiography` |
| Insight | title and `description` |
| Result | title and `description` |
| Industry | title and `description` |
| Office | title and `description` |
| Open role | title and `description` |

It searches those words only, not the full text of each page, so a clear `description` makes a page easier to find. Entries with `excludeFromCollection: true` are left out, and so are drafts in the production build.

How it behaves:

- Each word must match. "family Manchester" finds rows that contain both words.
- The address keeps the search: `/search/?q=visa` opens the page with "visa" already searched. Use it in links, for example from your 404 page.
- Without JavaScript, every row shows, so the page is still a full list of the site.
- The page is `noindex`, so search engines don't list it.

<Aside type="note">
  There is no search box in the header. Visitors reach `/search/` from the
  "Search the site" link on the 404 page, or from any link you add. To put it
  in the menu, add an item with `"url": "/search/"` to `headerPrimary` or a
  footer group in each `src/config/menu.<lang>.json`. See [Menus](/covena/customization/menus/).
</Aside>

### Change The Text
Everything on the page comes from `src/content/sections/<language>/search-list.md`:

```yaml
title: "Search the site"
description: "Find a guide, a practice area, a lawyer or an office."
label: "What are you looking for?"
placeholder: "For example: will, visa, Manchester"
submitLabel: "Search"
hint: "Type a word or two to see matching pages."
empty: "Nothing matches that search. Try a shorter word, or call us on +44 20 7946 0321."
count: "{count} results"
countOne: "1 result"
```

The `empty` message has the demo phone number in it. Change it to yours in every language.

### Choose What Is Searched
The `types` list in the same file names each kind of page in the results and sets their order:

```yaml
types:
  practice-areas: "Practice area"
  attorneys: "Attorney"
  blog: "Insight"
  results: "Result"
  industries: "Industry"
  offices: "Office"
  careers: "Open role"
```

- **Leave a kind out:** delete its line. For example, remove `careers` when you have no open roles.
- **Change the order:** move the lines. Results show in this order, then in the order of each collection.
- **Rename a kind:** change the text after the colon, in every language.

### Do It With AI
```text
Add a "Search" link to the Covena footer. In every src/config/menu.<lang>.json file, add
{ "enable": true, "name": "[LABEL IN THAT LANGUAGE]", "url": "/search/" } at the end of the
third group in "footer" (the "Help" group in English). Then remove the careers line from "types" in every
src/content/sections/<language>/search-list.md. Don't change anything else.
```