var ret = [] document.querySelectorAll("{{.ListItemCss}}").forEach((v, i) => { let item = {} if ("{{.ListLinkCss}}" != "") { let link = v.querySelector("{{.ListLinkCss}}") if (link) { var href = link.href if (!href.startsWith("http")) href = window.location.origin + "/" + href let title = link.getAttribute("title") || link.innerText item = { "listTitle": title, "href": href, "no": i } } else { item = { "no": i } } } if ("{{.ListPubtimeCss}}" != "") { let pubtime = v.querySelector("{{.ListPubtimeCss}}") if (pubtime) { item["listPublishTime"] = pubtime.innerText } } ret.push(item) }) ret