0

I have this page for showing articles, and I want to have links below the article to paginate to the next and previous.

This is my code:

{exp:channel:entries channel="articles" dynamic="yes" url_title="{segment:article}" status="open|featured" paginate="bottom"}
  <section class="block block--intro">
   <div class="panel">
    &lt;header class="panel__heading"&gt;
     <h1>{title}</h1>
    &lt;/header&gt;
    <div class="panel__body">
     <figure>
      {exp:ce_img:pair src="{article_featured_image}"}
       <img src="{made}" alt="" width="{width}" height="{height}" />
      {/exp:ce_img:pair}
     </figure>

    </div>
    <footer class="panel__footer">
     <ul class="list-unstyled list-inline meta">
      <li><i class="fa fa-user fa-fw"></i>Written by {author}</li>
      <li><i class="fa fa-calendar fa-fw"></i><time>{entry_date format="%F %j%S %Y"}</time></li>
      <li><i class="fa fa-folder-o fa-fw"></i>{categories}{category_name}, {/categories}</li>
     </ul>
    </footer>

   </div>
  </section>

  <main>
   <article class="article">
    <div class="wrapper">

          {article_content}


    </div>
   </article>

   {paginate}
    {if previous_page}
     <a href="{auto_path}">Previous Page</a> &nbsp;
    {/if}
    {if next_page}
     <a href="{auto_path}">Next Page</a>
    {/if}
   {/paginate}

  </main>



  {/exp:channel:entries}

For my Template Route for this template I have:

articles/{article:alpha_dash} and set Segments Required to Yes.

What am I doing wrong? No code is being displayed for the pagination.

1

The {paginate} tag is used to paginate multiple results on list pages. Since you are on a detail page and you are trying to link to next / previous entries in the articles channel, have you tried using the next / previous entry links instead?

Also, since you are using routes and url_title, you don't need EE to look at the URL structure. I would use dynamic="no". I would also use limit="1" in there.

2
  • Brilliant, this works a treat. Thanks for pointing me in the right direction. – Nick Toye Feb 16 '15 at 11:30
  • No problem. Glad I could be of some help. – Jérôme Coupé Feb 17 '15 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.