6 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
ac3d9aeb2d 1.0.7 2020-10-26 17:19:23 +00:00
c312622fb1 fix(core): update 2020-10-26 17:19:23 +00:00
89829b84f4 1.0.6 2020-10-26 12:18:49 +00:00
2b2111b2f1 fix(core): update 2020-10-26 12:18:49 +00:00
4 changed files with 27 additions and 4 deletions

2
package-lock.json generated
View File

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

View File

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

View File

@ -1,3 +1,4 @@
daily:
- central.eu/
- central.eu/privacy

View File

@ -1,5 +1,7 @@
import { SitemapNews } from './smartsitemap.classes.sitemapnews';
import { IUrlInfo, SitemapWebsite } from './smartsitemap.classes.sitemapwebsite';
import * as plugins from './smartsitemap.plugins';
import * as interfaces from './interfaces';
export class SmartSitemap {
constructor() {}
@ -16,7 +18,27 @@ export class SmartSitemap {
/**
* creates a normal sitemap from a list of urls
*/
public async createSitemapFromYmlString(yamlString: string) {
const yamlObject = await plugins.smartyaml.yamlStringToObject(yamlString);
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) {
sitemapWebsite.addUrl({
url: urlArg,
timestamp: Date.now() - 10000,
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();
}
}