Skip to main content

3.8 - Blog templates

A blog view shows a run of summarised articles: a heading, an image, a few lines, a link. Joomla alone decides what goes into that summary and in which order it comes out. You can hide the author or the date, but you cannot move the tags below the text, nor put the image in a column with the rest beside it.

The Blog templates tab of the style lifts that limit. You compose layouts for the card there, and assign one to each category. Sub-categories inherit it unless you decide otherwise.

It is the exact counterpart of the article templates of the next chapter: same principle, same screen, same map. One describes an article's page, the other its card inside a list.

This chapter is not about the blog view's own options: number of articles, number of columns, pagination. They stay where Joomla puts them, in the menu item, and the Blog views chapter covers them.

Where this is set

Style → Blog templates. You will find three things there:

  • Default blog template. The one used for articles whose category, and none of its parents, names one. Leave it on None until you have a reason to change it: with no default template, your lists keep Joomla's usual presentation.
  • The blog templates. The list of the ones you compose, plus the four that ship with Corpus.
  • The map, on the right. It draws each template as it will come out, and updates while you work.

Then, category by category: Content → Categories → your category → Corpus tab. A single field, Blog template. On Inherit, the category takes its parent's, and so on up to the style's default template.

One place to set it, on purpose. The assignment happens in the category and nowhere else: not in the menu item, not in the component. Settings spread over several levels contradict each other one day, and you spend the evening working out which one wins.

The four templates that ship with Corpus

They sit at the bottom of the list, marked read-only. None can be edited or deleted, each can be copied: the Copy button on its card turns it into an ordinary row that you only have to rearrange.

Template What it does
Image on the left One row of two columns, 5 / 7. The image on the left, everything else on the right.
Image on the right The mirror image, 7 / 5.
Image below A single column, the image after the Read more link.
Joomla default Joomla's usual presentation, to the character.

The first three give, under a plain name, what the image-left, image-right and image-bottom keywords of the menu item do without anyone being able to guess them. Nobody remembers those words.

image-alternate has no counterpart, and that is a limit worth knowing. A template describes one article; it does not know whether it is the second in the list. Alternating sides remains the job of the menu item's class, hence of a category with no template.

"Joomla default" serves twice

It is the way back: if a template goes wrong, put it back on the category and the list becomes Joomla's again, exactly. It is also the starting point: its copy gives you the core's order, which you then only have to rearrange.

One thing to know, so that it does not surprise you: assigned as is, it does not go through the rows, it goes back through Joomla's order. That is what makes it possible to state, and to check, that the native template assigned outputs exactly what no template outputs. Its copy, on the other hand, is an ordinary template: what is placed comes out, what is not placed does not.

What the template takes over

As soon as a category receives a blog template, it is the template that says where the image goes. The image-left, image-right and image-alternate keywords of the menu item no longer act on that category's articles.

This is not a loss, it is the same job done in one place. Other categories, the ones with no template, keep the class behaviour. And the 5 / 7 and 7 / 5 ratios are in the ratio list: they are exactly the proportions of the site's own card.

A template is composed in two tables

The rows

A row is a horizontal band inside the card. Rows stack in the order shown.

Setting What it does
Columns One, two or three.
Ratio The relative width of the columns, in twelfths: 5 / 7, 8 / 4, 3 / 6 / 3... Not applicable to a single-column row.
Background None, Alternate, a neutral grey, or Tinted, a derivation of the site hue, so it follows it.
Apply to Where the background sits: the whole row, or just one of its columns. Only appears once a background is chosen.

A row with no bricks does not come out. You can therefore prepare more rows than you need without spoiling the result.

Careful when moving a row. Bricks name a row by its number. Moving a row moves its number, not its content. Set the numbers in the brick table instead.

A background on a card calls for restraint: an article in a list already lives inside a card, and a flat tint inside a flat tint, repeated eight times down a page, reads as a fault. The setting is there because it serves in some cases; that is no reason to use it everywhere.

The bricks

One line, one brick. Within the same cell, they come out in the order shown.

Setting What it does
Brick What comes out. The full list is below.
Row The number of the row that receives it.
Column Full, Left, Centre or Right, depending on the row's column count.
Option A brick's only setting: the introduction length, the field, the field group, a date format, whether a link is shown.

A brick missing from the list does not come out. That is how you hide the hit count or the modification date: you do not look for a switch elsewhere, you do not place the brick.

The list of bricks

The content

Brick What it outputs
Article title The title and its link, as h2.
Intro image The Intro image from the Images and Links tab.
Introduction The introduction text, the part before Read more.
Read more The link to the full article.

The mentions

On an article's page they fit into a single brick, Information block. Here each has its own: that is what lets you place them where you want instead of choosing what the block contains.

Brick What it outputs
Information block The mentions together, as Joomla groups them.
Publication date With the Date: the whole sentence option, the date spelled out.
Creation date Same.
Modification date Same.
Author With the Author or category: with the link option, the name becomes a link.
Category Same.
Hit count The click counter.
Tags The article's tags.

The article's data

Brick What it outputs
A field One custom field, chosen in the Option.
A field group Every field of a group, as a spec sheet.

The rest

Brick What it outputs
Edit icons The pencil, for whoever may edit.
Plugins: after the title, before the content, after the content What your content plugins produce. If you do not place them, Corpus outputs them at the end anyway: nobody should lose content by forgetting a brick.
Breathing space Writes nothing, adds height. With the Horizontal rule option, a real <hr>.

There is no Modules brick, and that is deliberate. A module position rendered inside an article of the list would come out as many times as there are articles, with as many duplicate HTML identifiers. Offering a setting that could only do harm would be worse than not offering it.

The introduction length

This is the genuinely new setting on this screen, and it lives in the Option of the Introduction brick.

The list offers lengths in characters: 100, 150, 200, 300, 400, 600. A second series gives the same lengths without the ellipsis, for those who prefer a clean cut. With no option, the introduction comes out whole.

Three things to know:

  • The cut falls on a whole word, never mid-word, and it closes any open tags. A text shorter than the requested length is left untouched.
  • A non-breaking space precedes the ellipsis. Joomla sticks it to the last word; in French typography that is a fault, and it shows.
  • The length counts characters, not words. Allow room: 200 characters is about thirty words.

The cases that need explaining

A field that comes out twice, and here it counts double

A custom field set to Automatic display is already placed by Joomla. Placing it as a brick as well makes it come out twice per article: on a list of eight cards, that is sixteen. The option list tells you so at the very place where you choose.

The fix is in the field, not in the template: Fields → your field → Display options → Automatic display → Do not display automatically.

No Identifier field in the gear panel

A brick's gear panel offers one setting only, the Class. The article template has two, with the Identifier.

The reason fits in one sentence: the brick comes out once per article, and the same identifier would appear ten times on the page. The browser does not report it, the eye does not see it, and the day a CSS rule or a script uses it, only one of the ten answers. A class, by contrast, repeats without harm: that is its job.

The order of the mentions no longer comes from the menu item

Joomla's Information block position setting, which puts the mentions above, below or on both sides, only applies to the usual presentation. As soon as a template is assigned, it is the template that says where the mentions go, one by one.

An example: the recipe card

Two rows, to get the photograph on the left, the summary on the right, and the tags under the lot.

Row Columns Ratio What goes in
1 Two 5 / 7 Left: Intro image. Right: Title, Author, Category, Publication date, Introduction (200 characters), Read more
2 One   Tags

Start from a copy of Image on the left: the first row is already there, all that is left is moving the tags into a second one.

How many templates

Three or four are enough on most sites. Templates are stored in the style's parameters, like your other settings, and Corpus warns you well before room runs short.

Past a dozen, the difficulty is no longer technical: the list itself becomes tedious, and your writers will no longer know which to pick.

If a category has no template

It outputs exactly what Joomla outputs, to the character. That is not a figure of speech: it is checked on every release across sixteen combinations of settings, and a single space of difference stops the check.

In other words: a site that does not use blog templates does not move by a pixel when Corpus is installed, and a category whose template you remove goes straight back to the presentation it had before.

Up to date for Corpus 2.1.43.