1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-06-21 15:09:19 +00:00

bump(object-util,url-manager): bump patch

Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
This commit is contained in:
2023-07-12 15:13:06 +02:00
parent 231309ae7a
commit 4a4f0ddd1c
5 changed files with 26 additions and 23 deletions

View File

@ -1,5 +1,18 @@
import { ServerResponse } from 'http'
interface SitemapEntry {
changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'
lastmod?: Date
priority?: 1 | 0.9 | 0.8 | 0.7 | 0.6 | 0.5 | 0.4 | 0.3 | 0.2 | 0.1 | 0
images?: Array<{
location: string
caption?: string
geoLocation?: string
title?: string
license?: string
}>
}
export default class Sitemap {
private static allowedChangefreq = ['always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never']
@ -8,7 +21,8 @@ export default class Sitemap {
public constructor(
private domain: string, private options?: {
response?: ServerResponse
response?: ServerResponse,
defaults?: SitemapEntry
}
) {
if (this.options?.response) {
@ -22,18 +36,7 @@ export default class Sitemap {
* @param path the url path
* @param options aditional datas you want in the sitemap for the `path`
*/
public addEntry(path: string, options?: {
changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'
lastmod?: Date
priority?: 1 | 0.9 | 0.8 | 0.7 | 0.6 | 0.5 | 0.4 | 0.3 | 0.2 | 0.1 | 0
images?: Array<{
location: string
caption?: string
geoLocation?: string
title?: string
license?: string
}>
}) {
public addEntry(path: string, options?: SitemapEntry) {
let entryString = '<url>'
const url = this.fixText(`${this.domain}${path}`)