fixed the "all posts" category not being recognized
All checks were successful
Web/pipeline/head This commit looks good
All checks were successful
Web/pipeline/head This commit looks good
This commit is contained in:
parent
7470a20886
commit
d171f55eea
1 changed files with 4 additions and 8 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue