fix(core): update
This commit is contained in:
parent
ac3d9aeb2d
commit
7ae31b4ee0
@ -1,5 +1,5 @@
|
|||||||
import { SitemapNews } from './smartsitemap.classes.sitemapnews';
|
import { SitemapNews } from './smartsitemap.classes.sitemapnews';
|
||||||
import { SitemapWebsite } from './smartsitemap.classes.sitemapwebsite';
|
import { IUrlInfo, SitemapWebsite } from './smartsitemap.classes.sitemapwebsite';
|
||||||
import * as plugins from './smartsitemap.plugins';
|
import * as plugins from './smartsitemap.plugins';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ export class SmartSitemap {
|
|||||||
/**
|
/**
|
||||||
* creates a normal sitemap from a list of urls
|
* creates a normal sitemap from a list of urls
|
||||||
*/
|
*/
|
||||||
public async createSitemapFromYmlString(yamlString: string) {
|
public async createSitemapFromYmlString(yamlString: string): Promise<string> {
|
||||||
const yamlObject: interfaces.ISitemapYaml = await plugins.smartyaml.yamlStringToObject(yamlString);
|
const yamlObject: interfaces.ISitemapYaml = await plugins.smartyaml.yamlStringToObject(yamlString);
|
||||||
const sitemapWebsite = new SitemapWebsite();
|
const sitemapWebsite = new SitemapWebsite();
|
||||||
for(const urlArg of yamlObject.daily) {
|
for(const urlArg of yamlObject.daily) {
|
||||||
@ -28,5 +28,17 @@ export class SmartSitemap {
|
|||||||
frequency: 'daily'
|
frequency: 'daily'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return sitemapWebsite.exportSitemapXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a normal sitemap from a list of urls
|
||||||
|
*/
|
||||||
|
public async createSitemapFromUrlInfoArray(urlInfosArg: IUrlInfo[]) {
|
||||||
|
const sitemapWebsite = new SitemapWebsite();
|
||||||
|
for(const urlInfo of urlInfosArg) {
|
||||||
|
sitemapWebsite.addUrl(urlInfo);
|
||||||
|
}
|
||||||
|
return sitemapWebsite.exportSitemapXml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user