Render when there is a next page but no previous page.

97 views
Skip to first unread message

Wilds

unread,
Apr 17, 2013, 2:00:05 AM4/17/13
to tumblr...@googlegroups.com
Is there any way to make it so that a link only appears on the first page of either the tag or regular indexes i.e. when there is a next page but no previous page. I've tried arranging the NextPage and PreviousPage blocks in different combinations to no avail. Anything that renders on the first page always ends up rendering on all the next pages.

Wilds

unread,
Apr 17, 2013, 3:23:52 PM4/17/13
to tumblr...@googlegroups.com
Well, I can do a javascript check like this:

<script type="text/javascript">
    if ("{block:NextPage}test{/block:NextPage}" === "") document.write("output text");
</script>

I'd still like a solution only using tumblr variables though.

Jay

unread,
Apr 18, 2013, 10:22:48 AM4/18/13
to tumblr...@googlegroups.com
Try wrapping your link with {block:PreviousPage} display: none {/block:PreviousPage}

Olivia

unread,
Apr 24, 2013, 8:21:24 AM4/24/13
to tumblr...@googlegroups.com
{block:PreviousPage}<a href="{PreviousPage}">go back</a>{/block:PreviousPage) should only render if there is a previous page. Try sending your code...

Michael Theriot

unread,
Apr 25, 2013, 10:39:47 AM4/25/13
to tumblr...@googlegroups.com
{block:Pagination}{block:NextPage}<div class="nextpage page-{CurrentPage}">First page only</div>{/block:NextPage}{/block:Pagination}

This will create a <div> element when there is a next page, with the classes "nextpage" and "page-#" where # is the current page.

Since you want this to only appear on the first page you can add this CSS to hide it on other pages.
 
div.nextpage:not(.page-1) {
  display: none;
Reply all
Reply to author
Forward
0 new messages