Add search

Search is on as soon as Arc CMS is installed: published content is searchable by everyone, from a box in the site header and a results page at /search. Your job is to put the box where you want it and choose which extra fields count. The full reference is Search.

Place the search box

The box is the <arc-search></arc-search> element in the site header, src/custom/site/header.html (Arc CMS's sample, public/_site/header.html, until you write yours). Keep it where it should appear in your header, or remove it if you want no box. On published pages it becomes a plain form that works without JavaScript, with suggestions as you type; either way, it leads to /search (or /{lang}/search on a translated page).

On a translated page, the placeholder and messages come from that language's strings file, src/custom/site/strings/{lang}.json, like other template text (see Write a strings file).

Choose what is searched

The title, the summary and the author's name of every published item are always searched. The body is not. To add a custom field:

  1. Open Content, Content types, and edit the type.

  2. Under Searchable custom fields, tick the plain text fields that should count, such as a subtitle or a location. Only text fields can be ticked.

  3. Save. The search index for that type is rebuilt.

Drafts are searchable too, but only by admins, from the search box at the top of admin pages.

Check the index

Open Settings, then Search. Under What is searchable you see each source, who can search it, and how many documents and entries it holds. New and changed items are indexed when they are published; press Rebuild everything once after your first deploy, or whenever results look out of date.

The Collections list on the same screen is for data a developer adds in code; a website does not need it.

Next

Start collecting leads: Collect sign-ups.