MCPcopy Index your code
hub / github.com/ThatGuySam/doesitarm / parseSitemapXml

Function parseSitemapXml

helpers/api/sitemap/parse.js:32–55  ·  view source on GitHub ↗
( sitemapXml )

Source from the content-addressed store, hash-verified

30}
31
32export function parseSitemapXml ( sitemapXml ) {
33 // Get URLs from index
34 const sitemapRoot = parse( sitemapXml )
35
36 const {
37 sitemapindex = null,
38 urlset = null,
39 } = sitemapRoot
40
41
42 if ( sitemapindex !== null ) {
43 const {
44 sitemap
45 } = sitemapindex
46
47 const urlEntries = Array.isArray( sitemap ) ? sitemap : [ sitemap ]
48
49 return urlEntries
50 }
51
52 // console.log( 'sitemapRoot', sitemapRoot )
53
54 return urlset.url
55}
56
57export async function getAllUrlsFromLocalSitemap ( sitemapPath ) {
58 return await getAllUrlsFromSitemap( sitemapPath, {

Callers 2

getAllUrlsFromSitemapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected