Skip to content
New: Customize your theme with an AI assistant. Read the guide

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:

KindRow text
Practice areatitle and description
Attorneyname, role, and introBiography
Insighttitle and description
Resulttitle and description
Industrytitle and description
Officetitle and description
Open roletitle 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.

Change The Text

Everything on the page comes from src/content/sections/<language>/search-list.md:

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:

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

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.
Type something to search...