I am building a site where the URLs of a blog entry look like:


I am building out these urls by using entry_date. My links look like:

/blog/{entry_date format="%Y"}/{entry_date format="%m"}/{url_title}

The one thing I have not been able to figure out is how to use the Next/Previous Entries tags. Entry date values are not available in this tag pair so I have no way of grabbing the date values of the entry.

Any ideas?

4 Answers 4


Entry linking plugin would help you.


Nearby Entries will probably be your best bet as it includes the required parameters in your example: year, month, and url_title.

By way of a similar example for /year/month/day/url_title format:

<div class="nextprev nextprev-single">
    <div class="nav-previous">
        <span class="nextprev-arrow">&lsaquo;</span>
        {exp:nearby_entries:prev this_urltitle="{segment_4}" this_channel="blog" debug="n" limit="1"}
        <a href="{path=/}<?php echo date("Y/m/d", "{nearby:entry_date}"); ?>/{nearby:url_title}">
            <span class="nextprev-post">Previous Post</span>
            <span class="nextprev-single-link-title">{nearby:title}</span>
    </div><!-- /.nav-previous -->
    <div class="nav-next">
        {exp:nearby_entries:next this_urltitle="{segment_4}" this_channel="blog" debug="n" limit="1"}
        <a href="{path=/}<?php echo date("Y/m/d", "{nearby:entry_date}"); ?>/{nearby:url_title}">
            <span class="nextprev-post">Next Post</span>
            <span class="nextprev-single-link-title">{nearby:title}</span>
        <span class="nextprev-arrow">&rsaquo;</span>
    </div><!-- /.nav-next -->
</div><!-- /.nextprev -->

Just be sure to set PHP parsing to 'inward' for your template.


Thanks to both Bhashkar and Ian. I ended up using the Entry Linking plugin and CE:String like so:

{exp:entry_linking entry_id="{entry_id}" link="prev" channel="blog" status="open" mode="full" parse="inward"}
    <a href="/blog/{exp:ce_str:ing php}<?php echo date('Y/m', '{link_entry_date}'); ?>{/exp:ce_str:ing}/{link_url_title}">{link_title}</a>

The one drawback to the Entry Linking plugin is that you can't pass formatting to the entry_date like: {link_entry_date format="%Y/%m"} but luckily I was able to use PHP to convert the date for my purpose.

  • 1
    Another good option in CE String. I wasn't quite sure if you'd be able to bend it to your will in your particular case so I didn't mention it but it keeps things a little tidier. Glad you found a solution.
    – Ian Young
    Apr 12, 2013 at 18:36

I think the easiest method would be to use Advanced Prev Next Entry.

entry_date vars are in fact available in this tag pair. I know because I just tested it for you :)

{exp:channel:entries channel="blog"}

    {exp:bbr_prevnext_entry current_url_title="{segment_4}" channel_name="blog" orderby="entry_date" sort="asc" cycle="yes"}

        <a class="prev" href="/blog/{entry_date format="%Y"}/{entry_date format="%m"}/{prev_url_title}/">Previous</a>  
        <a class="next" href="/blog/{entry_date format="%Y"}/{entry_date format="%m"}/{next_url_title}/">Next</a>



Use this and forget about having to mess with turning on PHP or using a second add-on ;)

Note: make sure your orderby and sort are set the same on your listing page as they are set in the bbr_prevnext_entry params (or rather vice versa) other wise things could appear out of order.

Bonus: APNE allows you to do a full circle with your entries via the cycle param. Not something that comes standard with core Next/Previous Entry Linking tags to my knowledge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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