See More



Blog - CloudLinux
cloudlinux logo

The CloudLinux Blog

Subscribe Now
Community forum discontinued

CloudLinux has permanently discontinued the community forum at forum.cloudlinux.com. The decision follows an unauthorised-access incident against the forum’s...

Read More
' + '
' + '
' + '
' + '
' + '
' + ''; } return markup; } function setActiveButton(button) { filterButtons.forEach(function (btn) { btn.classList.remove("blog-filters__btn--active"); }); if (button) { button.classList.add("blog-filters__btn--active"); } } function updateHeroTitle(button) { if (!heroTitle) { return; } var label = button ? (button.getAttribute("data-topic-label") || "").trim() : ""; var key = button ? (button.getAttribute("data-topic-key") || "") : ""; if (!key || key === "all") { heroTitle.textContent = heroDefault; return; } heroTitle.textContent = label || heroDefault; } function getFilterUrl(page) { var base; if (activeTopicKey && activeTopicKey !== "all") { base = blogBasePath + "topic/" + activeTopicKey + "/"; } else if (activeCategorySlug) { base = blogBasePath + activeCategorySlug + "/"; } else { base = blogBasePath; } if (page > 1) { base += "page/" + page + "/"; } return base; } function updateContent(page, shouldPushState) { var payload = new FormData(); payload.append("action", "imunify_filter_blog_posts"); payload.append("nonce", "a7da5e693a"); payload.append("topic_key", activeTopicKey && activeTopicKey !== "all" ? activeTopicKey : ""); payload.append("category_id", String(activeCategoryId)); payload.append("paged", String(page)); container.classList.add("is-loading"); grid.classList.add("is-skeleton"); grid.innerHTML = getSkeletonMarkup(); fetch("https://blog.cloudlinux.com/wp-admin/admin-ajax.php", { method: "POST", credentials: "same-origin", body: payload }) .then(function (response) { return response.json(); }) .then(function (json) { if (!json || !json.success || !json.data) { return; } grid.innerHTML = json.data.posts || ""; var oldPagination = container.querySelector(".blog-pagination"); if (oldPagination) { oldPagination.remove(); } if (json.data.pagination) { grid.insertAdjacentHTML("afterend", json.data.pagination); } var topOffset = grid.getBoundingClientRect().top + window.pageYOffset - 20; window.scrollTo({ top: Math.max(0, topOffset), behavior: "smooth" }); if (shouldPushState) { var nextUrl = getFilterUrl(page); window.history.pushState( { topicKey: activeTopicKey, categoryId: activeCategoryId, categorySlug: activeCategorySlug, page: page }, "", nextUrl ); } }) .catch(function () { // Keep current content on request errors. }) .finally(function () { grid.classList.remove("is-skeleton"); container.classList.remove("is-loading"); }); } filterButtons.forEach(function (button) { button.addEventListener("click", function (event) { event.preventDefault(); var topicKey = (button.getAttribute("data-topic-key") || "all"); activeTopicKey = topicKey; activeCategoryId = 0; activeCategorySlug = ""; setActiveButton(button); updateHeroTitle(button); updateContent(1, true); }); }); container.addEventListener("click", function (event) { var link = event.target.closest(".blog-pagination a.page-numbers"); if (!link) { return; } event.preventDefault(); var href = link.getAttribute("href") || ""; var pageMatch = href.match(/\/page\/(\d+)\/?$/i); var page = pageMatch ? parseInt(pageMatch[1], 10) : 1; if (!page || Number.isNaN(page)) { page = 1; } updateContent(page, true); }); })();