mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add sitemap2 (#14972)
This commit is contained in:
parent
123ff1c182
commit
2f73151f60
52
sitemap2/index.d.ts
vendored
Normal file
52
sitemap2/index.d.ts
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
// Type definitions for sitemap2 1.0
|
||||
// Project: https://github.com/vlkosinov/sitemap2
|
||||
// Definitions by: Yuichi Shundo <https://github.com/shundy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var sitemap2: Sitemap;
|
||||
|
||||
export = sitemap2;
|
||||
|
||||
declare interface Sitemap {
|
||||
new (conf?: SitemapConfig): Sitemap;
|
||||
|
||||
addUrl(urlData: UrlData | UrlData[] | string | string[]): this
|
||||
addSitemap(sm: Sitemap): this;
|
||||
toXML(): SitemapXml[];
|
||||
|
||||
hostName: string;
|
||||
fileName: string;
|
||||
limit: number;
|
||||
urls: string[];
|
||||
childrens: Sitemap[];
|
||||
}
|
||||
|
||||
declare interface SitemapConfig {
|
||||
hostName?: string;
|
||||
fileName?: string;
|
||||
limit?: number;
|
||||
cacheTime?: number;
|
||||
xslUrl?: string;
|
||||
urls?: string[];
|
||||
childrens?: Sitemap[];
|
||||
}
|
||||
|
||||
declare interface UrlData {
|
||||
url: string;
|
||||
chengefreq?: string;
|
||||
priority?: number | string;
|
||||
lastmod?: Date;
|
||||
lastmodWithTime?: boolean;
|
||||
lastmodInISO?: boolean;
|
||||
video?: {
|
||||
title: string;
|
||||
description: string;
|
||||
thumbnail_loc: string;
|
||||
content_loc: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare interface SitemapXml {
|
||||
fileName: string;
|
||||
xml: string;
|
||||
}
|
||||
51
sitemap2/sitemap2-tests.ts
Normal file
51
sitemap2/sitemap2-tests.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import Sitemap = require('sitemap2');
|
||||
|
||||
let sitemap = new Sitemap({
|
||||
hostName: ('https://example.com/'),
|
||||
fileName: 'sitemap.xml',
|
||||
limit: 50000,
|
||||
cacheTime: 1000,
|
||||
});
|
||||
|
||||
sitemap.addUrl('https://example.com/');
|
||||
sitemap.addUrl(['https://example.com/']);
|
||||
sitemap.addUrl({
|
||||
url: 'https://example.com/',
|
||||
chengefreq: 'chengefreq',
|
||||
priority: 0.6,
|
||||
lastmod: new Date(),
|
||||
lastmodWithTime: true,
|
||||
lastmodInISO: false,
|
||||
video: {
|
||||
title: 'title',
|
||||
description: 'description',
|
||||
content_loc: 'content_loc',
|
||||
thumbnail_loc: 'thumbnail_loc'
|
||||
},
|
||||
});
|
||||
sitemap.addUrl([
|
||||
{
|
||||
url: 'https://example.com/',
|
||||
chengefreq: 'chengefreq',
|
||||
priority: 0.6,
|
||||
lastmod: new Date(),
|
||||
lastmodWithTime: true,
|
||||
lastmodInISO: false,
|
||||
video: {
|
||||
title: 'title',
|
||||
description: 'description',
|
||||
content_loc: 'content_loc',
|
||||
thumbnail_loc: 'thumbnail_loc'
|
||||
},
|
||||
},
|
||||
{
|
||||
url: 'http://example.com/'
|
||||
}
|
||||
]);
|
||||
|
||||
let sitemap2 = new Sitemap();
|
||||
sitemap.addSitemap(sitemap2);
|
||||
|
||||
const xmlList = sitemap.toXML();
|
||||
var str = xmlList[0].fileName;
|
||||
var str = xmlList[0].xml;
|
||||
22
sitemap2/tsconfig.json
Normal file
22
sitemap2/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sitemap2-tests.ts"
|
||||
]
|
||||
}
|
||||
1
sitemap2/tslint.json
Normal file
1
sitemap2/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Loading…
Reference in New Issue
Block a user