Skip to content

Instantly share code, notes, and snippets.

@travisjupp
Created August 21, 2017 22:37
Show Gist options
  • Save travisjupp/6bf8533d204dd0206130c09862117262 to your computer and use it in GitHub Desktop.
Save travisjupp/6bf8533d204dd0206130c09862117262 to your computer and use it in GitHub Desktop.
{% if previous_post.id.size > 0 %}
<div class="padtop padbottom">
<a href="{{ previous_post.url }}" class="submit-button btn btn-primary">Previous post: "{{ previous_post.headline }}"</a>
</div>
{% endif %}
{% if next_post.id.size > 0 %}
<div class="padtop padbottom">
<a href="{{ next_post.url }}" class="submit-button btn btn-primary">Next: "{{ next_post.headline }}"</a>
</div>
{% endif %}
@travisjupp
Copy link
Author

Add Next and Previous links to blog posts on your NationBuilder site
If you’re anything like our favourite progressive clients, you’ve got an excellent blog where your supporters keep up-to-date with your latest news. Your legendary crew are creating winning content for your campaign. People love reading your posts and always want more. Why not add a “Next” button so folk can easily continue through to each subsequent post with a click? You could even add a “Previous” button for all those history buffs! Read on to find out how…
The code snippet below won’t print anything to the page, but it will do the important work of creating 2 new liquid objects: “previous_post” and “next_post”. You will use those objects to add the links to your posts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment