assets/js/layout/post.mjs in hematite-0.1.13 vs assets/js/layout/post.mjs in hematite-0.1.14

- old
+ new

@@ -35,23 +35,24 @@ function createTagLinks(page) { let container = document.querySelector("#post_tags"); let label = document.querySelector("#post_tags > #tag_header_lbl"); label.innerText = stringLookup(`tags`); + // Don't show the tag container if there aren't any tags + if (!page.tags || page.tags.length == 0) { + container.style.display = "none"; + return; + } + for (const tag of page.tags) { let tagElem = document.createElement("a"); tagElem.style.display = "inline-block"; tagElem.classList.add(`post-tag`); tagElem.href = `{{ 'assets/html/all_tags.html' | relative_url }}#tag__${escape(tag)}`; tagElem.innerText = tag; container.appendChild(tagElem); - } - - // Don't show the tag container if there aren't any tags - if (page.tags.length == 0) { - container.style.display = "none"; } } function fillDate(page) { let postDateContainer = document.querySelector(`#post_date`);