Previous and Next article navigation | Community
Skip to main content

Previous and Next article navigation

  • June 23, 2017
  • 39 replies
  • 0 views

Show first post

39 replies

  • August 21, 2018

Thank you!  The previous/next button goes to draft articles only in the localized languages, but otherwise it works perfectly.


Trapta
  • August 22, 2018

Glad to hear that it worked. Enjoy :)


  • January 28, 2019

I replaced with the sections link below but mine do not link anywhere and just jump to the top of page when clicked

/en-us/sections/

Brett13
  • Community Manager
  • February 11, 2019

Hey Rachel,

We reached out to Trapta and it looks like she's been rather busy lately. We've passed your question along for when she's available to answer community questions again.

In the meantime I've attached some useful Help Center documentation for you below:

Cheers!


  • February 11, 2019

Thanks Brett I'm actually all set now


Brett13
  • Community Manager
  • February 12, 2019

Excellent news Rachel :)

Happy to hear you were able to get it all sorted out!


  • September 7, 2019

Hi,

Is there any way to have Previous and Next appear on articles within only one specific section?  I want them to appear within one section, but no where else.


Thanks in advance for the help,

Victoria


  • September 10, 2019

Hi Is there a way to have the 'next' button on the right hand side of the article instead of next to the 'prev' button?

Thanks in advance


Brett13
  • Community Manager
  • September 13, 2019

@Victoria and @Nerea this would require some custom code on your end to change where these buttons are located.

While I'm not able to assist with any sort of custom coding, we do have some documentation available that you may find useful:

I hope this helps point you in the right direction!


  • July 2, 2020

@Rachel Roberts I'm having the same issue when adding the code in. It doesn't seem to pick up the URL of the next article and I'm left with just a "#" as a link. How did you fix it?


Frances12
  • July 27, 2020

Hello!

I tried using this code. It actually works for section articles only but not for the subsection articles. Is there a way to customize the code so that the Previous and Next buttons would work on both section and subsection articles?


Brett13
  • Community Manager
  • August 13, 2020

Hey Frances,

Did you have any luck getting the Previous and Next buttons working on subsections? I wasn't able to track down anything on my end but wanted to see if you had any follow-up questions.

Let me know!


Frances12
  • September 4, 2020

Hey Brett,

 

Sorry for the late reply.

Unfortunately, there's still no way for me to use the buttons on subsections.

For your reference, this is the code that I used:

<script>
$(document).ready(function() {
var _location = $(".breadcrumbs li:nth-child(3) a").attr("href").split('/en-us/');
var _split = _location[1].split('-')[0];
var secId = _split.split('/')[1];

$.getJSON('/api/v2/help_center/en-us/sections/'+secId+'/articles.json', function(data) {
// change en-us to your Help center lang

console.log(data);// intialize list
$("#articles").html('<ul>');
var output = "";

for (var i in data.articles) {
output += "<li >";
output += "<a id='id-" + data.articles[i].id + "' href = '" + data.articles[i].html_url + "'>" + data.articles[i].title + "";
output += "</li>";
}
$("#articles ul").append(output); // append li
$("#articles ul").append('</ul>'); // close list
var prev = $('#id-{{article.id}}').parent().prev().find('a').attr('href');
var next = $('#id-{{article.id}}').parent().next().find('a').attr('href');
$('.article-head a:first-of-type').attr('href',prev);
$('.article-head a:last-of-type').attr('href',next);
});
});
</script>


  • December 3, 2020

The original solution from 3 years ago doesn't work (I get the same "greyed out" links that others have reported) and the latest posts are all snippets

I'm not able to piece a solution together.

Is someone able to summarize an up-todate how-to fir a user, with the Copenhaggen theme active, could add prev/next links? What snippets go in what files etc?