2014-10-10 09:54:07 -05:00
|
|
|
// ### Page URL Helper
|
|
|
|
//
|
|
|
|
// *Usage example:*
|
|
|
|
// `{{page_url 2}}`
|
|
|
|
//
|
2017-11-01 08:44:54 -05:00
|
|
|
// Returns the URL for the page specified in the current object context.
|
2017-04-04 11:07:35 -05:00
|
|
|
var proxy = require('./proxy'),
|
|
|
|
getPaginatedUrl = proxy.metaData.getPaginatedUrl;
|
2014-10-10 09:54:07 -05:00
|
|
|
|
2017-11-01 08:44:54 -05:00
|
|
|
// We use the name page_url to match the helper for consistency:
|
|
|
|
module.exports = function page_url(page, options) { // eslint-disable-line camelcase
|
2016-04-14 05:22:23 -05:00
|
|
|
if (!options) {
|
|
|
|
options = page;
|
|
|
|
page = 1;
|
|
|
|
}
|
2016-03-20 16:48:15 -05:00
|
|
|
return getPaginatedUrl(page, options.data.root);
|
2014-10-10 09:54:07 -05:00
|
|
|
};
|