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 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) {