Skip to main content

This page is for those who want to go beyond the settings. It assumes you can read HTML and CSS.

Custom CSS

System → Site Templates Styles → Corpus, Advanced tab, Custom CSS group. It is the right place for a short, site-specific touch-up.

The editor is CodeMirror, shipped with Joomla: syntax highlighting, line numbers, and F10 for full screen. Nothing extra is downloaded, and none of it reaches the public site: this is administration only.

Your CSS is added last, after Corpus's stylesheet. At equal specificity it wins: you do not need to escalate selectors.

It belongs to THIS style. If you create a second style, for a home page variant say, it will not have this CSS. That is deliberate: a touch-up specific to one part of a site should not spill over into the others.

Write tokens, not rules. Corpus exposes all its values as CSS custom properties. Rather than beating a selector, redefine the value it reads:

:root {
  --forme-carte-angle: 0;      /* square-cornered cards */
  --filet-part: 50%;           /* a shorter rule */
  --largeur-page: 1320px;      /* but prefer the Layout field */
}

A rule that needs !important to win almost always means you are going about it the wrong way.

The child template

To go further, Joomla can make one template inherit from another. The child contains only what it changes; everything else comes from Corpus, updates included.

Corpus declares inheritance: the Create child template button is available in System → Site Templates. A file missing from the child is looked up in the parent: that holds for layouts as well as for stylesheets and images. You only copy what you change.

On the difference between a style, a copy of a style and a child template, and on the question to ask yourself to know which one you need, see Styles, copies and child templates.

A child serves three purposes, in decreasing order of frequency:

  1. Redefining tokens: its own shapes, its own spacing.
  2. Overriding a layout that Corpus does not already override.
  3. Adding positions or changing the structure of index.php.

If you only need the first, a style is enough: see Shape variant in Appearance.

Template overrides

Corpus already overrides some twenty core layouts. They live in html/, arranged by component or module: html/com_contact/contact/, html/mod_menu/, and so on.

To add one, use System → Site Templates → Corpus → Create Override, which copies the core file to the right place.

Careful: an override added there will be overwritten by the next update. Create it in a child template instead: the Create Override button is offered on the child as well as on the parent, and what you put there survives Corpus's updates.

Editorial blocks

The fifteen blocks shipped are plain HTML files in html/tinymce/. You can add your own: an .html file dropped there appears in TinyMCE's Insert template button. The file name becomes the block name; the list is alphabetical.

One rule to respect if you write any. No style of your block may depend on a hand-typed class: TinyMCE strips <svg> on the first save, keeps classes and comments, and an author pasting content loses what they cannot see. Let the element carry the design, not the class.

Pictograms

Twenty-five hand-drawn SVG pictograms, in html/layouts/corpus/pictogrammes.php. They take the colour of the text; there is no icon font to load.

To place one in a menu: the Link Image Class field, with the symbol's name: i-accueil, i-recherche, i-etiquette…

To add one, add a <symbol id="i-myicon"> to the file, in a child template.

Carrying your settings

Style → Advanced settings → Backup and transport. This one section needs no code.

A Corpus style carries close to two hundred settings. Redoing them by hand on a second site takes an hour, and gets things wrong. Here a button produces a .json file in your downloads, and on the other side a file picker takes it back.

Two scopes, side by side, exactly the same mechanism:

  • on the left, the whole style: the hue, typography, layout, positions, custom CSS, the blog and article templates, everything the style has saved;
  • on the right, the article templates alone: the site default, your templates and your list of block classes, and nothing else. That is the scope you want once you have composed a good recipe sheet and want it elsewhere, without carrying another site's colours with it.

Under each button, a line says what the file holds: 187 settings, 14.4 KB, or 1 template, 7 rows, 18 blocks, 3 classes (7.4 KB). You know what you are carrying before you click.

What the export does not carry

It reads the saved settings, not what is on screen: if you have just changed something, save first.

It carries neither the menu assignment nor the templates assignment to categories. Those two do not live in the style but in Joomla's own tables, and a menu item id means nothing on another site: taking them would point at menus that do not exist.

What the import does, exactly

Choose the file, then save. Nothing is written before that.

  • Each setting in the file replaces the one in the style.
  • A setting missing from the file, or present but empty, is left as it is. An import therefore never erases anything, and that is what protects your custom CSS when the file comes from a site that had none. The other side of it: an import cannot empty a setting, you do that by hand.
  • What your version does not know is ignored, and you are told how many. A file from a newer version breaks nothing.
  • The field empties after saving: you do not import twice by saving twice.

One caveat for the templates scope: the list of templates is replaced, not added to, and your list of block classes with it.

The way back is the export facing it. Before importing, one click on the export button on the same side gives you the current state. Keep that file: it is your backup.

Updates

Install the zip over the previous one. Styles, their settings and your overrides in a child template are kept.

What is not kept: any change made directly in the files under templates/corpus/. That is the whole point of the child template.

Up to date for Corpus 2.1.43.