This project is not covered by Drupal’s security advisory policy.

Previous/Next (Back/Forward) links for entity and other pages, that allow to visit them in a sequence.

Unlike with the existing back/forward module, the sequence of items (entities etc) is not based on a view, but on hierarchical information already present in your site.

  • It provides a configurable block with prev/next links based on menu trees.
    The block is named "Treewalk Prev/Next (Menu)"
  • It provides Display suite fields with prev/next links based on entityreference / taxonomy_term_reference fields.
    The ds fields are named as "Treewalk Prev/Next (...)".

Example: Taxonomy + nodes

A structure with taxonomy and nodes:

term 1
- node 1.a
+ term 1.1
  - node 1.1.a
+ term 1.2
  - node 1.2.a
  - node 1.2.b
term 2
-  node 2.a
-  node 2.b
+  term 2.1
  - node 2.1.a
  - node 2.1.b
  + term 2.1.1
  + term 2.1.2
+  term 2.2
+  term 2.3

The module produces two back/forward sequences: One for nodes, another for terms.

Example 2: "parent node" entityreference (untested)

We need to model the book with an entity reference, where each node links to its parent.

book page 1
book page 2
+ book page 2.1
+ book page 2.2
  + book page 2.2.1
book page 3
+ book page 3.1

The module can produce back/forward links for those book pages, in sequence as above. (ok, this is still in development, but the architecture is designed to make this possible)

Example 3: Menu tree (book-like)

menu link 1
+ menu link 1.1
menu link 2
+ menu link 2.1
+ menu link 2.2

Back/Forward links will be produced with a sequence as above. The links will be exposed as block, because we are no longer dealing with entities.

Difference to Previous/Next API

We found that the hierarchical sort can not be easily modeled with Previous/Next API.

Also, we wanted a solution that works for entities other than nodes. We use the module for products on product/%, in combination with Commerce product page.

Unlike Previous/Next API, we do not cache or index anything. Instead, we have queries that just run fast enough :)


Create your hierarchy of taxonomy terms, and tag some nodes or other entities with this vocabulary.

Every TaxonomyTermReference, no matter which entity type, will create a prev/next field in the ds field settings. There you can specify the label for prev/next, and you are done.


This module still needs work on making the ordering customizable.
Also, some features are not yet implemented as advertised - but the architecture does allow for it.

Installation / requirements

It needs X Autoload or it won't work.


Sponsored by (100% of initial development).
Development by

Project Information