2 Commits

Author SHA1 Message Date
0a3768a088 1.0.8 2020-10-28 15:14:55 +00:00
7ae31b4ee0 fix(core): update 2020-10-28 15:14:54 +00:00
3 changed files with 16 additions and 4 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsitemap",
"version": "1.0.7",
"version": "1.0.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsitemap",
"version": "1.0.7",
"version": "1.0.8",
"private": false,
"description": "a sitemap module",
"main": "dist_ts/index.js",

View File

@ -1,5 +1,5 @@
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 interfaces from './interfaces';
@ -18,7 +18,7 @@ export class SmartSitemap {
/**
* 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 sitemapWebsite = new SitemapWebsite();
for(const urlArg of yamlObject.daily) {
@ -28,5 +28,17 @@ export class SmartSitemap {
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();
}
}