categories-page #44

Merged
rodude123 merged 3 commits from categories-page into master 2023-10-24 15:54:21 +01:00
2 changed files with 27 additions and 3 deletions
Showing only changes of commit da791c8866 - Show all commits

File diff suppressed because one or more lines are too long

View File

@ -376,9 +376,33 @@ async function loadIndividualPost(title)
});
}
function loadAllCategories()
/**
* Loads all the categories
*/
async function loadAllCategories()
{
document.title = 'Rohit Pai - Categories';
let categoriesList = await getCategories();
let main = document.querySelector('#main');
let categories = document.createElement('section');
categories.classList.add('categories');
categories.id = 'allCategories';
let h1 = document.createElement('h1');
h1.innerHTML = 'Categories';
main.appendChild(h1);
for (let category of categoriesList)
{
let btnContainer = document.createElement('div');
btnContainer.classList.add('btnContainer');
let btn = document.createElement('a');
btn.classList.add('btn');
btn.classList.add('btnPrimary');
btn.innerHTML = category;
btn.href = `/blog/category/${category}`;
btnContainer.appendChild(btn);
categories.appendChild(btnContainer);
}
main.appendChild(categories);
}
/**