fix(build): migrate build tooling to tsbuild v4 and tsbundle config while updating sitemap integration
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as interfaces from '../dist_ts_interfaces/index.js';
|
||||
import * as interfaces from '../ts_interfaces/index.js';
|
||||
import { DevToolsController } from './controllers/controller.devtools.js';
|
||||
import { TypedRequestController } from './controllers/controller.typedrequest.js';
|
||||
import { BuiltInRoutesController } from './controllers/controller.builtin.js';
|
||||
@@ -1056,32 +1056,31 @@ export class TypedServer {
|
||||
* Sitemap helper class
|
||||
*/
|
||||
class SitemapHelper {
|
||||
private smartSitemap = new plugins.smartsitemap.SmartSitemap();
|
||||
public urls: plugins.smartsitemap.IUrlInfo[] = [];
|
||||
public urls: plugins.smartsitemap.ISitemapUrl[] = [];
|
||||
|
||||
constructor(domain?: string) {
|
||||
if (domain) {
|
||||
this.urls.push({
|
||||
url: `https://${domain}/`,
|
||||
timestamp: Date.now(),
|
||||
frequency: 'daily',
|
||||
loc: `https://${domain}/`,
|
||||
lastmod: new Date(),
|
||||
changefreq: 'daily',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async createSitemap(): Promise<string> {
|
||||
return this.smartSitemap.createSitemapFromUrlInfoArray(this.urls);
|
||||
return plugins.smartsitemap.SmartSitemap.create().addUrls(this.urls).toXml();
|
||||
}
|
||||
|
||||
async createSitemapNews(articles: plugins.tsclass.content.IArticle[]): Promise<string> {
|
||||
return this.smartSitemap.createSitemapNewsFromArticleArray(articles);
|
||||
return plugins.smartsitemap.SmartSitemap.fromArticles(articles, { publicationName: 'News' }).toXml();
|
||||
}
|
||||
|
||||
replaceUrls(urlsArg: plugins.smartsitemap.IUrlInfo[]) {
|
||||
replaceUrls(urlsArg: plugins.smartsitemap.ISitemapUrl[]) {
|
||||
this.urls = urlsArg;
|
||||
}
|
||||
|
||||
addUrls(urlsArg: plugins.smartsitemap.IUrlInfo[]) {
|
||||
addUrls(urlsArg: plugins.smartsitemap.ISitemapUrl[]) {
|
||||
this.urls = this.urls.concat(urlsArg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user