Customizing the Reading Experience

Book List

The page that shows all your books is fully customizable with a Lava template. But before you go and write your own Lava, know that books now have an attribute in which you can upload a custom cover image. If you do so then it will be displayed instead of the generic cover image. So even without writing any custom Lava you can make your books page look much nicer.

There is a single variable available to you, but it's the only one that counts.

  • Books - An array of all the books to be displayed.

Book Reader

The page that lets you actually read books has a number of block settings to let you customize the look.

First, under the normal block settings there are templates for both Article Header and Article Footer. These are displayed just before the article content and just after the article content. Both are rendered in the middle column between the two TOC sections on the left and right.

The lava variables available in these templates are:

  • Article - The article currently being rendered.
  • Book - The book the article is a part of.
  • IsPrinting - Will be true if the render is being performed as a multi-article print request.
  • IsFirstArticle - Will be true if this is the first article being rendered.
  • IsLastArticle - Will be true if this is the last article being rendered.

Some of those might be a completely new concept. First off, if you specify "print=1" in the query string then the system will enter print mode. Since that causes multiple articles to be rendered, we provide the last two values as well. Between these three you can decide how you want to handle any custom rendering options during printing.

Tip

These Lava variables, along with CurrentPerson, are also available anywhere in the article when Merge Content has been enabled.

Next, under the Advanced Settings tab of the block settings are some additional settings you might want to make use of.

The first is the Show Panel option. When enabled, this will enclose the entire article (including both TOCs) inside a standard block panel. The book name will be used for the heading text.

The other two settings you can make use of are Page Header Template and Page Footer Template. These allow you to customize what is displayed at the very top and very bottom of the page. These would, for example allow you to render your own custom paneled look.

The lava variables available on these templates are:

  • Article - The main (first) article being rendered.
  • Book - The book the article belongs to.
  • IsPrinting - Will be true if this is a print request.

Using Lava

Each article can have Lava enabled or disabled (the default). If you enable the article's Merge Content setting then the entire rendered article will have a Lava merge performed on it.

This allows you to make your articles dynamic. For example, you could check for a specific attribute value on the current person and add in some extra text or links to other pages that they should read.

While you can use Lava anywhere in the structured editor, the way some of the blocks function may cause issues. For example, you try to use a paragraph block with line feeds, those get translated to HTML breaks which might mess up your Lava. But if you are using a simple one-liner, such as {{ CurrentPerson.NickName }}, you should be fine. For more advanced Lava, you can use the Raw HTML / Lava block.

Warning

While you can use the Raw HTML / Lava blocks to conditionally show or hide content by using {% if %} statements and {% endif %} statements in different blocks, care should be taken. The pre-merged content will be used for search results which might cause some information to be visible you didn't intend.