[FIX] _extension: backport 11.0 documentation layout
With canonical links, switcher, etc opw-2167071 where switching from version 10 -> 13 computed and incorrect link
This commit is contained in:
parent
267dd8620c
commit
ab228fe7dc
@ -25,6 +25,14 @@
|
||||
{{ super() }}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block linktags -%}
|
||||
{% for code, url in language_codes %}
|
||||
<link rel="alternate" hreflang="{{ code }}" href="{{ url }}" />
|
||||
{%- endfor %}
|
||||
<link rel="canonical" href="{{ canonical }}" />
|
||||
{{ super() }}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block sidebar1 -%}{%- endblock -%}
|
||||
{%- block sidebar2 -%}{%- endblock -%}
|
||||
{%- block relbar1 -%}{%- endblock -%}
|
||||
@ -39,6 +47,7 @@
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '{{ google_analytics_key }}', 'auto');
|
||||
ga('set', 'anonymizeIp', true);
|
||||
ga('send','pageview');
|
||||
</script>
|
||||
{%- endif -%}
|
||||
@ -71,8 +80,8 @@
|
||||
<li><a href="https://www.odoo.com/page/e-commerce">eCommerce</a></li>
|
||||
<li><a href="https://www.odoo.com/page/blog-engine">Blogs</a></li>
|
||||
<li><a href="https://www.odoo.com/page/community-builder">Forums</a></li>
|
||||
<li><a href="https://www.odoo.com/page/slides">Slides</a></li>
|
||||
<li><a href="https://adspike.odoo.com">SEA</a></li>
|
||||
<li><a href="https://www.odoo.com/page/learning-management-system">eLearning</a></li>
|
||||
<li><a href="https://www.odoo.com/page/live-chat">Live Chat</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-3 o_sale_apps">
|
||||
@ -89,10 +98,12 @@
|
||||
<ul>
|
||||
<li><a href="https://www.odoo.com/page/point-of-sale">Shops</a></li>
|
||||
<li><a href="https://www.odoo.com/page/pos-restaurant">Restaurants</a></li>
|
||||
<li><a href="https://www.odoo.com/page/point-of-sale-hardware">Hardware</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="https://www.odoo.com/page/subscriptions">Subscriptions</a></li>
|
||||
<li><a href="https://www.odoo.com/page/sign">Sign</a></li>
|
||||
<li><a href="https://www.odoo.com/page/rental">Rental</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-3 o_operation_apps">
|
||||
@ -106,12 +117,12 @@
|
||||
<li class="dropdown">
|
||||
<a href="#0" class="dropdown-toggle">Human Resources</a>
|
||||
<ul>
|
||||
<li><a href="https://www.odoo.com/page/recruitment">Recruitment</a></li>
|
||||
<li><a href="https://www.odoo.com/page/referral">Referral</a></li>
|
||||
<li><a href="https://www.odoo.com/page/employees">Employees</a></li>
|
||||
<li><a href="https://www.odoo.com/page/expenses">Expenses</a></li>
|
||||
<li><a href="https://www.odoo.com/page/appraisal">Appraisal</a></li>
|
||||
<li><a href="https://www.odoo.com/page/fleet">Fleet</a></li>
|
||||
<li><a href="https://www.odoo.com/page/leaves">Leaves</a></li>
|
||||
<li><a href="https://www.odoo.com/page/leaves">Time Off</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="https://www.odoo.com/page/warehouse">Inventory</a></li>
|
||||
@ -125,6 +136,8 @@
|
||||
<li><a href="https://www.odoo.com/page/quality">Quality</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="https://www.odoo.com/page/helpdesk">Helpdesk</a></li>
|
||||
<li><a href="https://www.odoo.com/page/field-service-management">Field Service</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-3 o_productivity_apps">
|
||||
@ -139,15 +152,23 @@
|
||||
<li><a href="https://www.odoo.com/page/discuss">Discuss</a></li>
|
||||
<li><a href="https://www.odoo.com/page/discuss-groups">Mailing Lists</a></li>
|
||||
<li><a href="https://www.odoo.com/page/notes">Notes</a></li>
|
||||
<li><a href="#">Help desk</a></li>
|
||||
<li><a href="#">Appointment</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="https://www.odoo.com/page/timesheet">Timesheet</a></li>
|
||||
<li><a href="https://www.odoo.com/page/email-marketing">Email Marketing</a></li>
|
||||
<li><a href="https://www.odoo.com/page/events">Events</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#0" class="dropdown-toggle">Marketing</a>
|
||||
<ul>
|
||||
<li><a href="https://www.odoo.com/page/marketing-automation">Automation</a></li>
|
||||
<li><a href="https://www.odoo.com/page/email-marketing">Email</a></li>
|
||||
<li><a href="https://www.odoo.com/page/social-marketing">Social</a></li>
|
||||
<li><a href="https://www.odoo.com/page/sms-marketing">SMS</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="https://www.odoo.com/page/survey">Survey</a></li>
|
||||
<li><a href="https://www.odoo.com/page/live-chat">Live Chat</a></li>
|
||||
<li><a href="https://www.odoo.com/page/approval-workflow">Approvals</a></li>
|
||||
<li><a href="https://www.odoo.com/page/appointments">Appointments</a></li>
|
||||
<li><a href="https://www.odoo.com/page/documents">Documents</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -242,7 +263,7 @@
|
||||
</div>
|
||||
</aside>
|
||||
{% endif %}
|
||||
<article class="doc-body {% if 'has-toc' in meta %}doc-toc{% endif %}{% if pagename in toc%}index-category{% endif %}">
|
||||
<article class="doc-body {% if 'has-toc' in meta %}doc-toc{% endif %} {% if pagename in toc%}index-category{% endif %}">
|
||||
{% endif %}
|
||||
{% block body %} {% endblock %}
|
||||
{% if pagename != master_doc %}</article>
|
||||
|
38
conf.py
38
conf.py
@ -287,6 +287,13 @@ texinfo_documents = [
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
odoo_cover_external = {
|
||||
'https://odoo.com/documentation/user/accounting/overview/main_concepts/memento.html' : 'banners/m_accounting.jpg',
|
||||
'https://odoo.com/documentation/user/inventory/overview/concepts/double-entry.html' : 'banners/m_1.jpg',
|
||||
'https://odoo.com/documentation/user/inventory/management/reporting/valuation_methods_continental.html' : 'banners/m_2.jpg',
|
||||
'https://odoo.com/documentation/user/inventory/management/reporting/valuation_methods_anglo_saxon.html' : 'banners/m_2.jpg',
|
||||
}
|
||||
|
||||
github_user = 'odoo'
|
||||
github_project = 'documentation-user'
|
||||
|
||||
@ -321,7 +328,9 @@ def setup(app):
|
||||
app.add_javascript('coa-valuation-continental.js')
|
||||
app.add_javascript('coa-valuation-anglo-saxon.js')
|
||||
|
||||
app.connect('html-page-context', canonicalize)
|
||||
app.add_config_value('canonical_root', None, 'env')
|
||||
app.add_config_value('canonical_branch', 'master', 'env')
|
||||
|
||||
app.connect('html-page-context', analytics)
|
||||
app.add_config_value('google_analytics_key', '', 'env')
|
||||
@ -342,8 +351,11 @@ def versionize(app, pagename, templatename, context, doctree):
|
||||
if not (app.config.canonical_root and app.config.versions):
|
||||
return
|
||||
|
||||
# remove last fragment containing the version
|
||||
root = '/'.join(app.config.canonical_root.rstrip('/').split('/')[:-1])
|
||||
|
||||
context['versions'] = [
|
||||
(vs, _build_url(app.config.canonical_root, vs, pagename))
|
||||
(vs, _build_url(root, vs, pagename))
|
||||
for vs in app.config.versions.split(',')
|
||||
if vs != app.config.version
|
||||
]
|
||||
@ -387,9 +399,33 @@ def localize(app, pagename, templatename, context, doctree):
|
||||
for la in app.config.languages.split(',')
|
||||
if la != current_lang
|
||||
]
|
||||
context['language_codes'] = [
|
||||
(la.split('_')[0] if la != 'en' else 'x-default', _build_url(app.config.canonical_root, (la != 'en' and la or ''), pagename))
|
||||
for la in app.config.languages.split(',')
|
||||
]
|
||||
|
||||
def canonicalize(app, pagename, templatename, context, doctree):
|
||||
""" Adds a 'canonical' URL for the current document in the rendering
|
||||
context. Requires the ``canonical_root`` setting being set. The canonical
|
||||
branch is ``master`` but can be overridden using ``canonical_branch``.
|
||||
/documentation/user/12.0/sale.html -> /documentation/user/13.0/sale.html
|
||||
/documentation/user/11.0/fr/website.html -> /documentation/user/13.0/fr/website.html
|
||||
"""
|
||||
if not app.config.canonical_root:
|
||||
return
|
||||
|
||||
# remove last fragment containing the version
|
||||
root = '/'.join(app.config.canonical_root.rstrip('/').split('/')[:-1])
|
||||
root += '/' + app.config.canonical_branch
|
||||
current_lang = app.config.language or 'en'
|
||||
|
||||
context['canonical'] = _build_url(
|
||||
root, (current_lang != 'en' and current_lang or ''), pagename)
|
||||
|
||||
def _build_url(root, branch, pagename):
|
||||
root = root.rstrip('/')
|
||||
if branch:
|
||||
root += '/'
|
||||
return "{canonical_url}{canonical_branch}/{canonical_page}".format(
|
||||
canonical_url=root,
|
||||
canonical_branch=branch,
|
||||
|
Loading…
Reference in New Issue
Block a user