import * as express from 'express'
import { asyncMiddleware } from '../middlewares'
-import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers'
+import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
import * as sitemapModule from 'sitemap'
-import { logger } from '../helpers/logger'
import { VideoModel } from '../models/video/video'
import { VideoChannelModel } from '../models/video/video-channel'
import { AccountModel } from '../models/account/account'
urls: urls
})
- sitemap.toXML((err, xml) => {
- if (err) {
- logger.error('Cannot generate sitemap.', { err })
- return res.sendStatus(500)
- }
+ const xml = sitemap.toXML()
- res.header('Content-Type', 'application/xml')
- res.send(xml)
- })
+ res.header('Content-Type', 'application/xml')
+ res.send(xml)
}
async function getSitemapVideoChannelUrls () {
// Sitemap description should be < 2000 characters
description: truncate(v.description || v.name, { length: 2000, omission: '...' }),
player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid,
- thumbnail_loc: WEBSERVER.URL + v.getThumbnailStaticPath()
+ thumbnail_loc: WEBSERVER.URL + v.getMiniatureStaticPath()
}
]
}))