By: Murray Wood Published on: 18/07/2016

An Extra for MODX that allows link creation to the next or previous resource.

An Extra for MODX that allows link creation to the next or previous resource.

If you get a chance, take a peek at an Extra I packaged for MODX called cycleResources. It can be downloaded from or directly from the package manager within MODX. It generates a link to the next or previous published resource in the same container and will loop through if the end is reached. It is perfect in a portfolio site or anything you need to dynamically link to the next/previous in a series.

It consists of a few snippets and a default template. You can currently choose either a next or a previous link and you can also choose to use your own chunk for custom formatting/styling.


The newest and easiest way is to simply call [[nextResource]] for the next resource and [[prevResource]] for the previous resource.

Use [[nextResource? &tpl=`myCustomTplChunk`]] to specify your own chunk for formatting.

For backwards compatibility, the [[cycleResources]] snippet is also included. To use the default template, and provide the "next" resource simply copy and paste: [[cycleResources]]

To use your own chunk for the template: [[cycleResources? &tpl=`myCustomTplChunk`]]

If you want the generated link to be for the "previous" resource instead of the next: [[cycleResources? &reverse=`1`]]


On duplicating a resource, at the time of writing by default MODX core does not assign a new menuindex to the new resource, so it's quite likely you'll end up with two resources that have the same menu index. This can cause cycleResources to skip the original resource and only display the new resource. To avoid this, change the MODX system setting "preserve_menuindex" to false.

Post Details

Category MODX Extra Development
Date 18/07/2016
Author Murray Wood
About The CycleResources Extra can be downloaded from the package manager inside MODX.

Latest Posts

Date 20/01/2017

Date 18/07/2016

MODExt Tutorial Series - Part 2
Date 02/07/2015

MODExt Tutorial Series - Part 1
Date 26/06/2015