fixed the "all posts" category not being recognized
All checks were successful
Web/pipeline/head This commit looks good

This commit is contained in:
Ell 2021-03-31 17:03:25 +02:00
parent 7470a20886
commit d171f55eea

View file

@ -9,14 +9,8 @@ $.ajax({
url: "blog/src/posts.json",
cache: false,
success: function (json) {
let category = "Featured";
let match = window.location.search.match(/cat=([^&]+)/);
if (match) {
let cat = decodeURI(match[1]);
if (json.some(p => p.cat.includes(cat)))
category = cat;
}
populateBlog(json, category);
let category = window.location.search.match(/cat=([^&]+)/);
populateBlog(json, category && decodeURI(category[1]) || "Featured");
forceToAnchor();
}
});
@ -58,6 +52,8 @@ function populateBlog(json, currCat) {
if (!archive.html())
archive.html(`<em>There are no archived ${currCat} posts.</em>`);
if (!list.html())
populateBlog(json, "Featured");
}
function addCatButton(json, cats, cat, currCat) {