This commit is contained in:
parent
23785fbb8e
commit
a1431fdd9a
1 changed files with 5 additions and 4 deletions
|
@ -15,7 +15,9 @@ $.ajax({
|
|||
}
|
||||
});
|
||||
|
||||
function populateBlog(json, currCat) {
|
||||
function populateBlog(json, currentCategory) {
|
||||
const currCat = currentCategory;
|
||||
|
||||
let anchors = $('#blog-cat-anchors');
|
||||
let archive = $('#blog-archive');
|
||||
let list = $('#blog-list');
|
||||
|
@ -33,8 +35,7 @@ function populateBlog(json, currCat) {
|
|||
let post = json[i];
|
||||
for (let cat of post.cat)
|
||||
addCategory(json, cats, anchors, cat, currCat);
|
||||
let catIds = post.cat.map(c => c.toLowerCase().replace(" ", "-"));
|
||||
if (currCat === "all-posts" || catIds.includes(currCat)) {
|
||||
if (currCat === "all-posts" || post.cat.some(c => c.toLowerCase().replace(" ", "-") === currCat)) {
|
||||
let p = /*html*/ `
|
||||
<div class="card bg-light blog-entry rounded-0">
|
||||
<div class="card-body">
|
||||
|
@ -56,7 +57,7 @@ function populateBlog(json, currCat) {
|
|||
if (!archive.html())
|
||||
archive.html(`<em>There are no archived posts in this category.</em>`);
|
||||
if (!list.html())
|
||||
populateBlog(json, "Featured");
|
||||
populateBlog(json, "featured");
|
||||
}
|
||||
|
||||
function addCategory(json, cats, anchors, cat, currCat) {
|
||||
|
|
Loading…
Reference in a new issue