Hey Anton, you can use JavaScript or jQuery to pull from an XML feed. For example, the code below takes my sitemap (you can change the URL to your own) and adds it to a #sitemap-list ul I’ve created in a Rich Text module (
(Note that this will only work on a published page since it gets a little fussy about pulling from your domain to app.hubspot.com on the Design Manager).
You could also add more complex HTML wrapper using jQuery but, since the sitemap.xml file only has the URL and last modified information, I don’t think you’ll be able to pull the page names from it.
I am also trying to rebuild a html sitemap from the hubspot sitemap.xml page and used a js function to try and fetch all the relevant data such as url and title to a more or less acceptable standard. It is only the first step and will probably need to turn it into a jQuery function to have it be fully intergratable.
it only works within the console while on the sitemap.xml page since I am still only testing everything out. hopefully jQuery will allow me to make something much simpler that wont rely as much on XMLHttpRequests… any input or help is of course highly appreciated!
var rawWebMap = document.querySelectorAll(‘.collapsible-content .text’);
var nbrRawPages= rawWebMap.length;
var webMap = {};
for(i=0;i<nbrRawPages;i++){
if(rawWebMap[i].textContent.includes(“http”))
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open(“GET”,rawWebMap[i].textContent,false);
xmlHttp.send(null);
var patt=/(?<=(<title>))(.*?)+?(?=<\s*\/\s*title>)/g;
var hyperTxt =xmlHttp.responseText;
webMap[rawWebMap[i].textContent]=hyperTxt.match(patt);
}
}
var nbrPages=webMap.length;
var uList=document.createElement(“ul”);
for(var key in webMap){
var item=document.createElement(“li”);
var link=document.createElement(“a”);
var theValue=[key]
link.setAttribute(‘href’,theValue);
var title=document.createTextNode(webMap[key]);
link.appendChild(title);
item.appendChild(link);
uList.appendChild(item);
}
var placeIn=document.getElementsByTagName(‘body’);
var firstChild=document.getElementById(“webkit-xml-viewer-source-xml”);
placeIn[0].insertBefore(uList,firstChild);