Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
8a78cc6831 | |||
911c680452 | |||
0a3768a088 | |||
7ae31b4ee0 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsitemap",
|
"name": "@pushrocks/smartsitemap",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsitemap",
|
"name": "@pushrocks/smartsitemap",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a sitemap module",
|
"description": "a sitemap module",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
export * from './smartsitemap.classes.smartsitemap';
|
export * from './smartsitemap.classes.smartsitemap';
|
||||||
export * from './smartsitemap.classes.sitemapnews';
|
export * from './smartsitemap.classes.sitemapnews';
|
||||||
|
export * from './smartsitemap.classes.sitemapwebsite';
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user