1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-06-07 16:49:56 +00:00

Fixed bug (#33)

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
Florian Bouillon 2021-09-28 15:41:18 +02:00 committed by GitHub
parent 393d686681
commit 44887c3d41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,10 +68,10 @@ export default class Sitemap {
} }
entryString += '<image:image>' entryString += '<image:image>'
entryString += `<image:loc>${this.fixText(image.location.startsWith('/') ? `${this.domain}${image.location}` : image.location)}</image:loc>` entryString += `<image:loc>${this.fixText(image.location.startsWith('/') ? `${this.domain}${image.location}` : image.location)}</image:loc>`
entryString += this.fixText(this.optionalEntry('image:caption', image.caption)) entryString += this.optionalEntry('image:caption', image.caption)
entryString += this.fixText(this.optionalEntry('image:geo_location', image.geoLocation)) entryString += this.optionalEntry('image:geo_location', image.geoLocation)
entryString += this.fixText(this.optionalEntry('image:title', image.title)) entryString += this.optionalEntry('image:title', image.title)
entryString += this.fixText(this.optionalEntry('image:license', image.license)) entryString += this.optionalEntry('image:license', image.license)
entryString += '</image:image>' entryString += '</image:image>'
} }
} }
@ -98,7 +98,7 @@ export default class Sitemap {
} }
private optionalEntry(tag: string, entry?: string) { private optionalEntry(tag: string, entry?: string) {
return entry ? `<${tag}>${entry}</${tag}>` : '' return entry ? `<${tag}>${this.fixText(entry)}</${tag}>` : ''
} }
private fixText(txt: string): string { private fixText(txt: string): string {