Pagination within a single article

  1. Background
  2. Download & install
  3. Page breaks & titles
  4. Navigation, conditionals, & search

Navigation, conditionals, & search

soo_article_page_number produces plain text output, and knows the current page and the total number of pages in the document. You can see its default output just above the prev/next links at the bottom of the page.

Along with soo_article_page_link, the other link-generating tag in the suite is soo_article_page_nav, which outputs a complete set of page links. The table of contents appearing on every page of this article is from the following code:

<txp:soo_article_page_nav wraptag="ol" break="li" text="{title}" />

By default it will use page numbers for link text, with a <br> between links:



For the current page, it displays plain text.

The tag actually calls soo_article_page_link to do most of the work, so its text attribute works the same way.

The prev/next links at the bottom of the page come from this code (the containing ul tags are not shown):

<txp:soo_if_article_page first="0">
    <li><txp:soo_article_page_link rel="prev" text="{prev} {page}: {title}" /></li>
<txp:soo_if_article_page last="0">
    <li><txp:soo_article_page_link rel="next" text="{next} {page}: {title}" /></li>


By default this tests whether or not the article has multiple pages. It takes two attributes, first and last, which allow narrowing the test to whether you are on the first page (first="1"), on the last page (last="1"), not on the first page (first="0"), not on the last page (last="0"), or not on either (first="0" last="0").

Search results

Of course Txp’s native search tags will not produce links to pages as defined by soo_page_break, so if you use the Txp search engine you will want to modify your search results form to include the soo_article_page_search_url tag. (You’ll want to do this, even though that is a ridiculously long tag name.) It produces a link to the first page matching the search query. In standalone mode it uses the URL as the link text. Used as a container tag it uses the tag contents as the link text.

Posted 2017-03-09 (last modified 2017-03-10)

Page 5 of 6