made the navigation static again
This commit is contained in:
parent
5f52d0a808
commit
2bcc913560
2 changed files with 4 additions and 21 deletions
|
@ -41,7 +41,10 @@ function createBlogPages(folder) {
|
||||||
|
|
||||||
var nav = "";
|
var nav = "";
|
||||||
nav += '<a class="nav-item nav-link" href="/#blog">Back to Main Page</a>';
|
nav += '<a class="nav-item nav-link" href="/#blog">Back to Main Page</a>';
|
||||||
nav += '<script src="scripts/blog-nav.js"></script>';
|
if (i > 0)
|
||||||
|
nav += '<a class="nav-item nav-link" href="/blog-' + json[i - 1]["id"] + '">Previous Post</a>';
|
||||||
|
if (i < json.length - 1)
|
||||||
|
nav += '<a class="nav-item nav-link" href="/blog-' + json[i + 1]["id"] + '">Next Post</a>';
|
||||||
document.getElementById("nav-items").innerHTML = nav;
|
document.getElementById("nav-items").innerHTML = nav;
|
||||||
|
|
||||||
var c = "";
|
var c = "";
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
$.ajax({
|
|
||||||
dataType: "json",
|
|
||||||
url: "blog/posts.json",
|
|
||||||
cache: false,
|
|
||||||
success: function (json) {
|
|
||||||
for (let i = json.length - 1; i >= 0; i--) {
|
|
||||||
let post = json[i];
|
|
||||||
if (!$("#blog-post-" + post["id"]).length)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
let nav = "";
|
|
||||||
if (i > 0)
|
|
||||||
nav += '<a class="nav-item nav-link" href="/blog-' + json[i - 1]["id"] + '">Previous Post</a>';
|
|
||||||
if (i < json.length - 1)
|
|
||||||
nav += '<a class="nav-item nav-link" href="/blog-' + json[i + 1]["id"] + '">Next Post</a>';
|
|
||||||
$("#nav-items").append(nav);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
Loading…
Reference in a new issue