From f350cc375661a4308cbadd961cd274e55566160d Mon Sep 17 00:00:00 2001 From: Ryo Chiba Date: Thu, 7 Nov 2024 16:55:28 -0800 Subject: [PATCH] Resolves issue #154: Enables field parsing even when some items may not include field --- src/assets/sitemapper.js | 2 +- src/tests/test.ts.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/assets/sitemapper.js b/src/assets/sitemapper.js index 9b32939..e873d73 100644 --- a/src/assets/sitemapper.js +++ b/src/assets/sitemapper.js @@ -331,7 +331,7 @@ export default class Sitemapper { } else { let fields = {}; for (const [field, active] of Object.entries(this.fields)) { - if(active){ + if(active && site[field]){ fields[field] = site[field][0] } } diff --git a/src/tests/test.ts.ts b/src/tests/test.ts.ts index 34185bb..680a6bf 100644 --- a/src/tests/test.ts.ts +++ b/src/tests/test.ts.ts @@ -119,9 +119,9 @@ describe('Sitemapper', function () { }); }); - it('https://www.channable.com/sitemap.xml sitemaps should contain extra fields', function (done) { + it('https://wp.seantburke.com/sitemap.xml sitemaps should contain extra fields', function (done) { this.timeout(30000); - const url = 'https://www.channable.com/sitemap.xml'; + const url = 'https://wp.seantburke.com/sitemap.xml'; sitemapper = new Sitemapper({ fields: { "loc": true, "lastmod": true,