From e673484b35bc2f36aae3c4957925aa0eef4ac0df Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 4 Sep 2018 15:35:04 +0200 Subject: [PATCH] [FIX] web_editor: image name Add the image name in the website for SEO purpose. This is a backport of: 88a5d9a0000a5ea43afdc00ed 886c07dabb636767b80abb849 152e3f8686ec4f48ba22e5c13 opw-1880472 --- addons/web_editor/static/src/js/widgets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js index dc347c61690..a3a990a7baf 100644 --- a/addons/web_editor/static/src/js/widgets.js +++ b/addons/web_editor/static/src/js/widgets.js @@ -390,7 +390,7 @@ var ImageDialog = Widget.extend({ $form.find('.well > span').remove(); $form.find('.well > div').show(); _.each(attachments, function (record) { - record.src = record.url || '/web/image/' + record.id; + record.src = record.url || _.str.sprintf('/web/image/%s/%s', record.id, encodeURI(record.name)); // Name is added for SEO purposes record.is_document = !(/gif|jpe|jpg|png/.test(record.mimetype)); }); if (error || !attachments.length) { @@ -447,7 +447,7 @@ var ImageDialog = Widget.extend({ return (r.url || r.id); }); _.each(this.records, function (record) { - record.src = record.url || '/web/image/' + record.id; + record.src = record.url || _.str.sprintf('/web/image/%s/%s', record.id, encodeURI(record.name)); // Name is added for SEO purposes record.is_document = !(/gif|jpe|jpg|png/.test(record.mimetype)); }); this.display_attachments();