Sourcefabric Manuals

 English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

Newscoop 4.3 Cookbook

Breaking up long articles with subheaders and pagination

In this chapter, you will learn an advanced method for list pagination, and how to use subtitles to break up long articles. 

Subtitles inside long Article Fields

You can include subtitles (also known as subheads) in longer articles, to break the article into pages. The journalist uses the WYSIWYG editor, marks the subtitle in the text and selects "campsite_subhead" from the top line of icons. A simple list of all subtitles inside the article, with the currently opened subtitle highlighted and with the numbers indicating which subhead it is can be displayed on the article page like this:

{{ list_subtitles field_name="full_text" }} 
<li{{ if ($gimme->article->current_subtitle_no(body)+1) == $gimme->current_list->index }} class="active"{{ /if }}>
<a href="{{ url }}">{{ $gimme->current_list->index }} of {{ $gimme->current_list->count }} - {{ $gimme->subtitle->name }}</a>
{{ /list_subtitles }}

Note that inside list_subtitles you need to specify the article field which you are working with, in this case the field full_text. The subtitles listed will all be from this particular article field, rather than any other field that may contain subtitles.

Adding a simple "previous" and "next" navigation from article subtitle to article subtitle can be done like this:

{{ if $gimme->article->full_text->has_previous_subtitles }}
    <a href="{{ url options="previous_subtitle full_text" }}">Previous</a>
{{ else }}
{{ /if }}
{{ if $gimme->article->full_text->has_next_subtitles }}
    <a href="{{ url options="next_subtitle full_text" }}">Next</a>
{{ else }}
{{ /if }}

This navigation will display active links to "Previous" or "Next" only if there is a previous or next item in the list. Otherwise, the words Previous and Next are not clickable, and are just displayed for design reasons, so the eye does not need to jump back and forth.

Once you are using subtitles in an article with pagination, the content will no longer be displayed in a single page format. In order to display the entire article in a single page (e.g. for printing) you can use a link with options like this:

<a href="{{ uri options="all_subtitles full_text" }}">View entire article</a>

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.