fix(builders): skip articles without URLs when importing into sitemap builders
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartsitemap',
|
||||
version: '4.0.1',
|
||||
version: '4.0.2',
|
||||
description: 'A comprehensive TypeScript sitemap library with builder API, supporting standard, news, image, video, and hreflang sitemaps with auto-splitting, streaming, validation, and RSS feed integration.'
|
||||
}
|
||||
|
||||
@@ -76,6 +76,9 @@ export class NewsSitemapBuilder extends UrlsetBuilder {
|
||||
*/
|
||||
importFromArticles(articles: plugins.tsclass.content.IArticle[]): this {
|
||||
for (const article of articles) {
|
||||
if (!article.url) {
|
||||
continue;
|
||||
}
|
||||
this.add({
|
||||
loc: article.url,
|
||||
lastmod: article.timestamp ? new Date(article.timestamp) : undefined,
|
||||
|
||||
@@ -149,6 +149,9 @@ export class UrlsetBuilder {
|
||||
/** Import from @tsclass/tsclass IArticle array */
|
||||
importFromArticles(articles: plugins.tsclass.content.IArticle[]): this {
|
||||
for (const article of articles) {
|
||||
if (!article.url) {
|
||||
continue;
|
||||
}
|
||||
const url: interfaces.ISitemapUrl = {
|
||||
loc: article.url,
|
||||
lastmod: article.timestamp ? new Date(article.timestamp) : undefined,
|
||||
|
||||
Reference in New Issue
Block a user