The Ghost Themes Developer Hub

Welcome to the Ghost Themes developer hub. You'll find comprehensive guides and documentation to help you start working with Ghost Themes as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

page_url

{{page_url}} Helper - Output the URL for a given page in a list (i.e. next page)

Usage: {{page_url 2}} or {{page_url next}} or {{page_url "next"}}

Type
Parameters
Attributes

page number (number)
or
"next" or "prev" (string)

n/a

Description

This helper is used in the pagination template required by the {{pagination}} helper to output the URL for the next, previous or a specific page. It expects a variable which contains the page number you want to output.

The helper can also interpret the strings "next" and "prev", to display a next/previous link outside of the context of pagination.

Examples

Hint

Switch between the Handlebars and HTML tabs to see the the output from the helper

Handlebars from the default pagination.hbs template, HTML shows the output when on page 2 of 3.

<nav class="pagination" role="navigation">
    {{#if prev}}
        <a class="newer-posts" href="{{page_url prev}}">&larr; Newer Posts</a>
    {{/if}}
    <span class="page-number">Page {{page}} of {{pages}}</span>
    {{#if next}}
        <a class="older-posts" href="{{page_url next}}">Older Posts &rarr;</a>
    {{/if}}
</nav>
<nav class="pagination" role="navigation">
    <a class="newer-posts" href="/">&larr; Newer Posts</a>
    <span class="page-number">Page 2 of 3</span>
    <a class="older-posts" href="/page/3/">Older Posts &rarr;</a>
</nav>

page_url

{{page_url}} Helper - Output the URL for a given page in a list (i.e. next page)