6 Commits

Author SHA1 Message Date
35680b135d 1.0.10 2020-10-28 15:54:39 +00:00
3170da0303 fix(core): update 2020-10-28 15:54:39 +00:00
8a78cc6831 1.0.9 2020-10-28 15:26:34 +00:00
911c680452 fix(core): update 2020-10-28 15:26:34 +00:00
0a3768a088 1.0.8 2020-10-28 15:14:55 +00:00
7ae31b4ee0 fix(core): update 2020-10-28 15:14:54 +00:00
5 changed files with 26 additions and 7 deletions

2
package-lock.json generated
View File

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

View File

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

View File

@ -1,2 +1,3 @@
export * from './smartsitemap.classes.smartsitemap';
export * from './smartsitemap.classes.sitemapnews';
export * from './smartsitemap.classes.sitemapnews';
export * from './smartsitemap.classes.sitemapwebsite';

View File

@ -5,7 +5,13 @@ export class SitemapNews {
constructor(optionsArg: {}) {}
public async readAndAddFromRssFeed(urlArg: string) {
public async readAndAddFromRssFeedString(feedStringArg: string) {
const smartfeedInstance = new plugins.smartfeed.Smartfeed();
const parsedFeed = await smartfeedInstance.parseFeedFromString(feedStringArg);
this.items = this.items.concat(parsedFeed.items);
}
public async readAndAddFromRssFeedUrl(urlArg: string) {
const smartfeedInstance = new plugins.smartfeed.Smartfeed();
const parsedFeed = await smartfeedInstance.parseFeedFromUrl(urlArg);
this.items = this.items.concat(parsedFeed.items);

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';
@ -11,14 +11,14 @@ export class SmartSitemap {
*/
public async createSitemapNewsFromFeedUrl(feedUrlArg: string): Promise<string> {
const sitemapNewsInstance = new SitemapNews({});
await sitemapNewsInstance.readAndAddFromRssFeed(feedUrlArg);
await sitemapNewsInstance.readAndAddFromRssFeedUrl(feedUrlArg);
return sitemapNewsInstance.exportSitemapXml();
}
/**
* 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();
}
}