diff --git a/services/sitemaps/src/routes/google-news.js b/services/sitemaps/src/routes/google-news.js index a1d85fde9..13f25210f 100644 --- a/services/sitemaps/src/routes/google-news.js +++ b/services/sitemaps/src/routes/google-news.js @@ -43,19 +43,17 @@ const createPublication = (name, language) => { return `${parts.join('')}`; }; -const createUrl = (website, url, publicationName) => { - const { - loc, - title, - published, - publication, - images, - } = url; - const name = publicationName || publication.name; +const createUrl = (website, { + loc, + title, + published, + publication, + images, +}) => { // News requires a publication, a published date and a title. - if (!name || !published || !title) return null; + if (!publication || !published || !title) return null; const parts = [ - createPublication(name, website.language.primaryCode), + createPublication(publication.name, website.language.primaryCode), `${moment(published).toISOString()}`, `${xml.encode(title)}`, ]; @@ -66,7 +64,6 @@ const createUrl = (website, url, publicationName) => { module.exports = asyncRoute(async (req, res) => { const input = parseJson(req.get('x-google-news-input') || '{}'); - const publicationName = req.get('x-google-news-publication-name'); const variables = input ? { input } : undefined; const { apollo, websiteContext: website } = res.locals; @@ -80,7 +77,7 @@ module.exports = asyncRoute(async (req, res) => { .setAttr('xmlns:image', 'http://www.google.com/schemas/sitemap-image/1.1') .setAttr('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance') .setAttr('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-news/0.9 http://www.google.com/schemas/sitemap-news/0.9/sitemap-news.xsd') - .setUrls(contentSitemapNewsUrls.map(url => createUrl(website, url, publicationName))); + .setUrls(contentSitemapNewsUrls.map(url => createUrl(website, url))); res.end(urlset.build()); });