Getting started

Environments and indexing

Every Gansey site runs in one of four environments, set with [server].env or GANSEY_ENV:

EnvironmentError detailSearch engines
localshownnever indexed
devshownnever indexed
staginghiddennever indexed
productionhiddenindexed unless switched off in the admin

The default is local. Gansey also accepts development for dev, stage or test for staging, and prod or live for production. Any other value logs a warning and is treated as local. The environment is read once at start-up, so changing it needs a restart.

Set it on every install, not only production: a staging copy left on local shows error detail to anyone who triggers an error.

Error reporting

In local and dev, API error responses carry the underlying message and server error pages show the detail with a note saying why. In staging and production an error page says only "Something went wrong" and the detail goes to the log.

[server].error_reporting (or GANSEY_ERROR_REPORTING) overrides this either way. Set it to true to see detail on a staging site while you chase a problem, or false to hide it on a developer machine. Leave it unset to follow the environment.

The environment changes one sign-in behaviour too. When no email is configured, the admin shows an emailed sign-in link on screen only in local and dev, whatever error_reporting says. Elsewhere that would let anyone sign in as anyone. See Users and sign-in.

Indexing

Only production is ever indexable, so a copy of a client's site on a staging host cannot end up in search results by accident. When a site is not indexable:

  • /robots.txt answers with Disallow: / for every agent, under a comment naming the environment;
  • every public page carries <meta name="robots" content="noindex, nofollow"> and an X-Robots-Tag: noindex, nofollow header.

When it is indexable, /robots.txt allows everything except /admin/, /api/ and /_preview/, and points at /sitemap.xml on the site's public_url. Modules listening on the robots.txt hook can add lines in either case (see Modules).

Preview links, search results and not-found pages are marked noindex in every environment.

The Settings switch

In production you can still keep a site out of search engines, for example while a client reviews it on its real domain before launch. In the admin, open Theme & settings, and in the Site card turn on Ask search engines not to index this site. The change takes effect straight away and is recorded in the activity log. It needs the manage_site capability.

The switch is stored in the database, so it survives restarts and updates. It has no effect outside production, where indexing is always off. The card shows the current environment and which of the two applies.

Seeing where a site stands

The admin shows the environment in several places, so nobody mistakes staging for the live site:

  • the top bar shows a pill with the environment name on anything but production, and a noindex pill whenever the site is not indexable;
  • the dashboard's Environment card shows the environment and whether the site is indexable;
  • the dashboard's Core health list has an Indexing row that says whether search engines are allowed, switched off in settings, or never indexed in this environment.

For monitoring, GET /api/health answers without signing in, with the version and database status. GET /api/health/detail returns everything in Core health as JSON and needs a signed-in session.