small fixes
Web/pipeline/head This commit looks good Details

This commit is contained in:
Ell 2021-04-04 02:01:25 +02:00
parent 23785fbb8e
commit a1431fdd9a
1 changed files with 5 additions and 4 deletions

View File

@ -15,7 +15,9 @@ $.ajax({
} }
}); });
function populateBlog(json, currCat) { function populateBlog(json, currentCategory) {
const currCat = currentCategory;
let anchors = $('#blog-cat-anchors'); let anchors = $('#blog-cat-anchors');
let archive = $('#blog-archive'); let archive = $('#blog-archive');
let list = $('#blog-list'); let list = $('#blog-list');
@ -33,8 +35,7 @@ function populateBlog(json, currCat) {
let post = json[i]; let post = json[i];
for (let cat of post.cat) for (let cat of post.cat)
addCategory(json, cats, anchors, cat, currCat); addCategory(json, cats, anchors, cat, currCat);
let catIds = post.cat.map(c => c.toLowerCase().replace(" ", "-")); if (currCat === "all-posts" || post.cat.some(c => c.toLowerCase().replace(" ", "-") === currCat)) {
if (currCat === "all-posts" || catIds.includes(currCat)) {
let p = /*html*/ ` let p = /*html*/ `
<div class="card bg-light blog-entry rounded-0"> <div class="card bg-light blog-entry rounded-0">
<div class="card-body"> <div class="card-body">
@ -56,7 +57,7 @@ function populateBlog(json, currCat) {
if (!archive.html()) if (!archive.html())
archive.html(`<em>There are no archived posts in this category.</em>`); archive.html(`<em>There are no archived posts in this category.</em>`);
if (!list.html()) if (!list.html())
populateBlog(json, "Featured"); populateBlog(json, "featured");
} }
function addCategory(json, cats, anchors, cat, currCat) { function addCategory(json, cats, anchors, cat, currCat) {