Previous and Next article navigation
답변함I am wondering how to enable some kind of Previous and Next article navigation in my articles within a category. Any thoughts?
-
Excellent news Rachel :)
Happy to hear you were able to get it all sorted out!
-
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
-
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
-
@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:
- Using themes and templates to customize your Help Center
- Help Center CSS Cookbook
- Help Center Templates Introduction
- Help Center Javascript Cookbook
- Tips for using HTML to customize your Help Center
I hope this helps point you in the right direction!
-
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?
-
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?
-
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!
-
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> -
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?
댓글을 남기려면 로그인하세요.
39 댓글