Skip to content

Commit

Permalink
Merge pull request #1 from itaikla/hotfix/search-console-fixes
Browse files Browse the repository at this point in the history
Update search-console.js
  • Loading branch information
itaikla authored Feb 1, 2024
2 parents 11515db + e8593f8 commit a1fb004
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions search-console/search-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const webmasters = google.webmasters({
// Replace with your site URL
const siteUrl = 'https://example.com';

// TODO: remove
webmasters.sitemaps.list({
siteUrl,
}, (err, response) => {
Expand All @@ -33,3 +34,28 @@ webmasters.sitemaps.list({
console.log('No sitemaps found for the specified site.');
}
});
//

webmasters.sitemaps.list({
siteUrl,
}, (err, response) => {
// Handle error case
if (err) {
console.error('Error:', err);
return;
}

const sitemaps = response.data.sitemap;

// Check if sitemaps exist
if (sitemaps && sitemaps.length > 0) {
console.log('List of sitemaps:');

// Log each sitemap path
sitemaps.forEach((sitemap) => {
console.log(sitemap.path);
});
} else {
console.log('No sitemaps found for the specified site.');
}
});

0 comments on commit a1fb004

Please sign in to comment.