Human readable
Text meant for people instead of code: the label an editor sees for a content type, field or style, and a URL made of words such as /about-us.
In Drupal, "human readable" marks text written for the people who use the site, as opposed to the identifiers that code and configuration depend on. It has two common faces: the name or label shown in the admin interface, and the address of a page when it is made of words instead of an internal number.
Names and labels
Content types, vocabularies, views and image styles each carry two values. The label is free text, and the machine name is the ID. The content type form in core shows this: its Name field is described as the human-readable name, displayed on the Content types page, and a separate machine name field is filled in from it.
The MachineName form element calls its source field the human-readable name and fills the ID from it as you type. A config entity type declares which of its properties is the label; for content types the entity keys map id to type and label to name. Entity type definitions have the same split: getLabel() returns the human-readable name of the type.
Labels can change. In the configuration schema, the label data type is marked translatable, so a label can exist in several languages while the ID stays fixed.
Readable URLs
An internal path such as /node/7 works but says nothing. A URL alias maps a readable address such as /about-us to that path. The Path module help says aliases make URLs more readable and that one internal path can have several aliases. The contributed Pathauto module writes aliases for you from patterns; its project page gives /category/my-node-title instead of /node/123 as the goal.
Example
Exported configuration keeps both values side by side. This is the image style that core's Standard profile ships in its optional configuration:
name: max_650x650
label: 'Max 650x650'
Site builders pick "Max 650x650" from a list in the image formatter settings. The URLs and code for that style use max_650x650.
Common mistakes
- Using a label as an ID. A template or script that matches on "Case study" breaks the day someone fixes the wording. Match on the machine name.
- Writing labels only for yourself. A label that is clear to the builder but not to an editor ("Type 2") makes the admin screens harder to use.
- Treating an alias as permanent. The alias is the readable address, and editing it replaces that address. The Path module help describes redirects as a separate feature for changed or inactive URLs.
For marketing and content teams
Choose labels that your own editors will recognize in a list of fifty items, and agree on the wording of important URLs before launch. A short, descriptive address is easier to read out loud and to check in a report.
Sources
- Drupal core 11.4.10: NodeTypeForm (Name and machine name fields)
- Drupal core 11.4.10: MachineName form element
- Drupal core 11.4.10: core.data_types.schema.yml (label type)
- Drupal core 11.4.10: Standard profile image style max_650x650
- Drupal core 11.4.10: Path module help text
- Drupal.org: Pathauto project