I want to create a script that loops through a list of sitemap urls and returns the total count of pages for each record to a field in my table called “Page Count”
var x = xmlDoc.getElementsByTagName("loc"); return(x.length);
But I’m not sure how to pull in an xml doc hosted at a specific url or loop through airtable records…anyone willing to provide a little direction?
you would want to use the fetch() function. something like:
let urlContent = await fetch(sitemapLink) let text = await urlContent.body()
let to convert that to an xml doc:
let parser = new DOMParser(); xmlDoc = parser.parseFromString(text,"text/xml");