summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2019-11-22 15:16:27 +0000
committerJeremy Kersten <jke@odoo.com>2019-12-16 11:07:19 +0000
commit7921616aeaf0b18ffe598c2bf20b62e6f235d757 (patch)
treeb650d4e26794fa8a869e966813281a2485d12921
parentab56c9e46435e96ede0617c78f17c102f6caf7f3 (diff)
[IMP] website: allow to submit sitemap to Google
partial of opw-2123610
-rw-r--r--addons/website/models/res_config_settings.py10
-rw-r--r--addons/website/views/res_config_settings_views.xml203
-rw-r--r--addons/website_form/views/res_config_view.xml2
3 files changed, 120 insertions, 95 deletions
diff --git a/addons/website/models/res_config_settings.py b/addons/website/models/res_config_settings.py
index 1a7d3c93508..18782c57854 100644
--- a/addons/website/models/res_config_settings.py
+++ b/addons/website/models/res_config_settings.py
@@ -4,6 +4,7 @@
from ast import literal_eval
from odoo import api, fields, models
+from odoo.tools.translate import _
class ResConfigSettings(models.TransientModel):
@@ -169,6 +170,15 @@ class ResConfigSettings(models.TransientModel):
'target': 'new',
}
+ def action_ping_sitemap(self):
+ if not self.website_id._get_http_domain():
+ raise Warning(_("You don't have defined your domain"))
+ return {
+ 'type': 'ir.actions.act_url',
+ 'url': 'http://www.google.com/ping?sitemap=%s/sitemap.xml' % self.website_id._get_http_domain(),
+ 'target': 'new',
+ }
+
def install_theme_on_current_website(self):
self.website_id._force()
action = self.env.ref('website.theme_install_kanban_action').read()[0]
diff --git a/addons/website/views/res_config_settings_views.xml b/addons/website/views/res_config_settings_views.xml
index 2f64aa20627..d4fcecfcd33 100644
--- a/addons/website/views/res_config_settings_views.xml
+++ b/addons/website/views/res_config_settings_views.xml
@@ -141,88 +141,7 @@
<field name="website_logo" widget="image" class="w-25 mt-2"/>
</div>
</div>
- <div class="col-12 col-lg-offset-6 col-lg-6 o_setting_box" id="google_analytics_setting">
- <div class="o_setting_left_pane">
- <field name="has_google_analytics"/>
- </div>
- <div class="o_setting_right_pane">
- <label for="has_google_analytics"/>
- <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
- <div class="text-muted">
- Track visits in Google Analytics
- </div>
- <div class="content-group" attrs="{'invisible': [('has_google_analytics', '=', False)]}">
- <div class="row mt16">
- <label class="col-lg-3 o_light_label" string="Tracking ID" for="google_analytics_key"/>
- <field name="google_analytics_key" placeholder="UA-XXXXXXXX-Y"
- attrs="{'required': [('has_google_analytics', '=', True)]}"/>
- </div>
- </div>
- <div attrs="{'invisible': [('has_google_analytics', '=', False)]}">
- <a href="https://www.odoo.com/documentation/user/13.0/website/optimize/google_analytics.html"
- class="oe_link" target="_blank">
- <i class="fa fa-arrow-right"/>
- How to get my Tracking ID
- </a>
- </div>
- </div>
- </div>
- <div class="col-12 col-lg-offset-6 col-lg-6 o_setting_box" id="google_console_setting">
- <div class="o_setting_left_pane">
- <field name="has_google_search_console"/>
- </div>
- <div class="o_setting_right_pane">
- <label for="has_google_search_console"/>
- <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
- <div class="text-muted">
- Monitor Google Search results data
- </div>
- <div class="content-group" attrs="{'invisible': [('has_google_search_console', '=', False)]}">
- <div class="row mt16">
- <label class="col-lg-3 o_light_label" string="Code" for="google_search_console"/>
- <field name="google_search_console" placeholder="google1234567890123456.html"
- attrs="{'required': [('has_google_search_console', '=', True)]}"/>
- </div>
- </div>
- <div attrs="{'invisible': [('has_google_search_console', '=', False)]}">
- <small class='text-muted'>
- <i class="fa fa-info"/>: type some of the first chars after 'google' is enough, we'll guess the rest.
- </small>
- </div>
- </div>
- </div>
- <div class="col-12 col-lg-6 o_setting_box" id="google_analytics_dashboard_setting" attrs="{'invisible': [('has_google_analytics', '=', False)]}">
- <div class="o_setting_left_pane">
- <field name="has_google_analytics_dashboard"/>
- </div>
- <div class="o_setting_right_pane">
- <label for="has_google_analytics_dashboard"/>
- <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
- <div class="text-muted">
- Follow your website traffic in Odoo.
- </div>
- <div class="content-group" attrs="{'invisible': [('has_google_analytics_dashboard', '=', False)]}">
- <div class="row mt16">
- <label class="col-lg-3 o_light_label" string="Client ID" for="google_management_client_id"/>
- <field name="google_management_client_id" attrs="{'required': [('has_google_analytics_dashboard', '=', True)]}"/>
- </div>
- <div class="row">
- <label class="col-lg-3 o_light_label" string="Client Secret" for="google_management_client_secret"/>
- <field name="google_management_client_secret" attrs="{'required': [('has_google_analytics_dashboard', '=', True)]}"/>
- </div>
- </div>
- <div attrs="{'invisible': [('has_google_analytics_dashboard', '=', False)]}">
- <a href="https://www.odoo.com/documentation/user/online/website/optimize/google_analytics_dashboard.html"
- class="oe_link" target="_blank">
- <i class="fa fa-arrow-right"/>
- How to get my Client ID
- </a>
- </div>
- </div>
- </div>
- <div class="col-12 col-lg-6 o_setting_box"
- id="force_account_per_website_setting"
- groups="website.group_multi_website">
+ <div class="col-12 col-lg-6 o_setting_box" id="force_account_per_website_setting" groups="website.group_multi_website">
<div class="o_setting_left_pane">
<field name="specific_user_account"/>
</div>
@@ -309,18 +228,6 @@
<field name="social_default_image" widget="image" class="w-25 mt-2"/>
</div>
</div>
- <div class="col-12 col-lg-6 o_setting_box" id="robots_setting">
- <div class="o_setting_right_pane">
- <span class="o_form_label">Robots.txt</span>
- <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
- <div class="text-muted">
- Tells to search engine crawlers which pages or files the crawler can or can't request from your site
- </div>
- <div class="mt8">
- <button type="object" name="action_open_robots" string="Edit robots.txt" class="btn-link" icon="fa-android"/>
- </div>
- </div>
- </div>
</div>
<h2>Features</h2>
@@ -373,6 +280,114 @@
</div>
</div>
</div>
+
+ <h2>SEO</h2>
+ <div class="row mt16 o_settings_container" id="seo_settings">
+ <div class="col-12 col-lg-offset-6 col-lg-6 o_setting_box" id="google_analytics_setting">
+ <div class="o_setting_left_pane">
+ <field name="has_google_analytics"/>
+ </div>
+ <div class="o_setting_right_pane">
+ <label for="has_google_analytics"/>
+ <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
+ <div class="text-muted">
+ Track visits in Google Analytics
+ </div>
+ <div class="content-group" attrs="{'invisible': [('has_google_analytics', '=', False)]}">
+ <div class="row mt16">
+ <label class="col-lg-3 o_light_label" string="Tracking ID" for="google_analytics_key"/>
+ <field name="google_analytics_key" placeholder="UA-XXXXXXXX-Y"
+ attrs="{'required': [('has_google_analytics', '=', True)]}"/>
+ </div>
+ </div>
+ <div attrs="{'invisible': [('has_google_analytics', '=', False)]}">
+ <a href="https://www.odoo.com/documentation/user/13.0/website/optimize/google_analytics.html"
+ class="oe_link" target="_blank">
+ <i class="fa fa-arrow-right"/>
+ How to get my Tracking ID
+ </a>
+ </div>
+ </div>
+ </div>
+ <div class="col-12 col-lg-offset-6 col-lg-6 o_setting_box" id="google_console_setting">
+ <div class="o_setting_left_pane">
+ <field name="has_google_search_console"/>
+ </div>
+ <div class="o_setting_right_pane">
+ <label for="has_google_search_console"/>
+ <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
+ <div class="text-muted">
+ Monitor Google Search results data
+ </div>
+ <div class="content-group" attrs="{'invisible': [('has_google_search_console', '=', False)]}">
+ <div class="row mt16">
+ <label class="col-lg-3 o_light_label" string="Code" for="google_search_console"/>
+ <field name="google_search_console" placeholder="google1234567890123456.html"
+ attrs="{'required': [('has_google_search_console', '=', True)]}"/>
+ </div>
+ </div>
+ <div attrs="{'invisible': [('has_google_search_console', '=', False)]}">
+ <small class='text-muted'>
+ <i class="fa fa-info"/>: type some of the first chars after 'google' is enough, we'll guess the rest.
+ </small>
+ </div>
+ </div>
+ </div>
+ <div class="col-12 col-lg-6 o_setting_box" id="google_analytics_dashboard_setting" attrs="{'invisible': [('has_google_analytics', '=', False)]}">
+ <div class="o_setting_left_pane">
+ <field name="has_google_analytics_dashboard"/>
+ </div>
+ <div class="o_setting_right_pane">
+ <label for="has_google_analytics_dashboard"/>
+ <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
+ <div class="text-muted">
+ Follow your website traffic in Odoo.
+ </div>
+ <div class="content-group" attrs="{'invisible': [('has_google_analytics_dashboard', '=', False)]}">
+ <div class="row mt16">
+ <label class="col-lg-3 o_light_label" string="Client ID" for="google_management_client_id"/>
+ <field name="google_management_client_id" attrs="{'required': [('has_google_analytics_dashboard', '=', True)]}"/>
+ </div>
+ <div class="row">
+ <label class="col-lg-3 o_light_label" string="Client Secret" for="google_management_client_secret"/>
+ <field name="google_management_client_secret" attrs="{'required': [('has_google_analytics_dashboard', '=', True)]}"/>
+ </div>
+ </div>
+ <div attrs="{'invisible': [('has_google_analytics_dashboard', '=', False)]}">
+ <a href="https://www.odoo.com/documentation/user/online/website/optimize/google_analytics_dashboard.html"
+ class="oe_link" target="_blank">
+ <i class="fa fa-arrow-right"/>
+ How to get my Client ID
+ </a>
+ </div>
+ </div>
+ </div>
+ <div class="col-12 col-lg-6 o_setting_box" id="robots_setting">
+ <div class="o_setting_right_pane">
+ <span class="o_form_label">Robots.txt</span>
+ <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
+ <div class="text-muted">
+ Robots.txt: Tells to search engine crawlers which pages or files the crawler can or can't request from your site.<br/>
+ </div>
+ <div class="mt4">
+ <button type="object" name="action_open_robots" string="Edit robots.txt" class="btn-link" icon="fa-android"/>
+ </div>
+ </div>
+ </div>
+ <div class="col-12 col-lg-6 o_setting_box" id="robots_setting">
+ <div class="o_setting_right_pane">
+ <span class="o_form_label">Sitemap</span>
+ <span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
+ <div class="text-muted mt8">
+ Sitemap.xml: Help search engine crawlers to find out what pages are present and which have recently changed, and to crawl your site accordingly (This file is automatically generated by Odoo).
+ </div>
+ <div class="mt4">
+ <button type="object" name="action_ping_sitemap" string="Submit sitemap to Google" class='btn-link' icon="fa-google"/>
+ </div>
+
+ </div>
+ </div>
+ </div>
</div>
</xpath>
</field>
diff --git a/addons/website_form/views/res_config_view.xml b/addons/website_form/views/res_config_view.xml
index 3da76728868..3998dadf564 100644
--- a/addons/website_form/views/res_config_view.xml
+++ b/addons/website_form/views/res_config_view.xml
@@ -4,7 +4,7 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form"/>
<field name="arch" type="xml">
- <xpath expr="//div[@id='google_analytics_dashboard_setting']" position="before">
+ <xpath expr="//div[@id='social_default_image_setting']" position="before">
<div class="col-12 col-lg-6 o_setting_box" groups="base.group_no_one" name="metadata_setting_container">
<div class="o_setting_left_pane">
<field name="website_form_enable_metadata"/>