/* DigiCreates industry news strip: fills #dcNewsList on /blog// hubs with the 3 latest posts from that industry's -news subcategory. */ (function () { var CATS = { "healthcare": 40, "ecommerce": 41, "fintech": 42, "startups": 43, "real-estate": 44, "hospitality": 45, "education": 46, "consulting-legal": 47, "saas": 48, "automotive": 49, "pharmaceuticals": 50, "logistics": 51, "retail": 52, "digital-health": 53, "medtech": 54, "medical-tourism": 55, "advertising": 56 }; var m = /^\/blog\/([a-z-]+)\/?$/.exec(window.location.pathname); if (!m || !CATS[m[1]]) { return; } var sec = document.querySelector(".dc-in-news"); if (!sec) { return; } var css = document.createElement("style"); css.textContent = ".dc-in-news{max-width:1160px;margin:26px auto 0;padding:0 16px;font-family:'Plus Jakarta Sans',Inter,sans-serif}" + ".dc-in-news .dcin-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;border-top:1px solid #E5E7EB;padding-top:18px}" + ".dc-in-news .dcin-h{font-size:17px;font-weight:700;letter-spacing:-0.2px;margin:0;color:#0F172A}" + ".dc-in-news .dcin-all{font-size:12.5px;font-weight:600;color:#A855F7;text-decoration:none;white-space:nowrap}" + ".dc-in-news .dcin-all:hover{text-decoration:underline}" + ".dc-in-news .dcin-list{list-style:none;margin:12px 0 0;padding:0;display:grid;gap:8px}" + ".dc-in-news .dcin-item{display:flex;align-items:baseline;gap:10px;font-size:13.5px;line-height:1.45}" + ".dc-in-news .dcin-item a{color:#0F172A;text-decoration:none;font-weight:600}" + ".dc-in-news .dcin-item a:hover{color:#A855F7}" + ".dc-in-news .dcin-date{color:#64748B;font-size:12px;white-space:nowrap}" + "@media(max-width:600px){.dc-in-news .dcin-head{flex-direction:column;align-items:flex-start;gap:2px}}"; document.head.appendChild(css); fetch("/wp-json/wp/v2/posts?categories=" + CATS[m[1]] + "&per_page=3&orderby=date&order=desc&_fields=id,link,title,date", { headers: { "Accept": "application/json" } }) .then(function (r) { return r.ok ? r.json() : []; }) .then(function (posts) { if (!Array.isArray(posts) || posts.length === 0) { sec.style.display = "none"; return; } var ul = document.getElementById("dcNewsList"); if (!ul) { return; } ul.innerHTML = ""; posts.forEach(function (p) { var li = document.createElement("li"); li.className = "dcin-item"; var a = document.createElement("a"); a.href = p.link; a.textContent = (p.title && p.title.rendered) ? p.title.rendered : ""; var d = new Date(p.date.replace(" ", "T")); var span = document.createElement("span"); span.className = "dcin-date"; span.textContent = d.toLocaleDateString("en-US", { month: "short", day: "numeric" }); li.appendChild(a); li.appendChild(span); ul.appendChild(li); }); }) .catch(function () { sec.style.display = "none"; }); })();