Skip to content

Commit

Permalink
[9.0][website_canonical_url] Migrate.
Browse files Browse the repository at this point in the history
  • Loading branch information
yajo authored and pedrobaeza committed Dec 24, 2016
1 parent 8fbca72 commit a81c0b4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
11 changes: 8 additions & 3 deletions website_canonical_url/README.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=====================
Website Canoncial URL
=====================

This module adds a HTML tag in the header that contains a canoncial URL for the current page.
This module is a SEO booster that adds a HTML tag in the header that contains a
`canoncial URL <https://support.google.com/webmasters/answer/139066>`_ for the
current page, no matter what query it gets, and `rel=next and rel=prev links
<https://webmasters.googleblog.com/2011/09/pagination-with-relnext-and-relprev.html>`_
wherever a pager is found.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/186/8.0

:target: https://runbot.odoo-community.org/runbot/186/9.0

Bug Tracker
===========
Expand Down
4 changes: 2 additions & 2 deletions website_canonical_url/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
'author': "initOS GmbH, Tecnativa, Odoo Community Association (OCA)",
'website': "http://www.initos.com",
'category': 'Website',
'version': '8.0.1.1.0',
'version': '9.0.1.1.0',
'license': 'AGPL-3',
'depends': [
'website',
],
'data': [
'views/templates.xml',
'templates/layout.xml',
],
}
28 changes: 28 additions & 0 deletions website_canonical_url/templates/layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 Jairo Llopis <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<template id="canonical_url_link"
inherit_id="website.layout"
name="Canonical URL">
<xpath expr="//title" position="after">
<t t-if="request and website">
<t t-set="canonical_url"
t-value="website.get_canonical_url(request)"/>
<t t-if="canonical_url">
<link rel="canonical" t-att-href="canonical_url"/>
</t>
<t t-if="pager and pager.get('page_count', 0) > 1">
<link t-if="pager['page']['num'] != 1"
rel="prev"
t-att-href="url_for(pager['page_previous']['url'])"/>
<link t-if="pager['page']['num'] != pager['page_count']"
rel="next"
t-att-href="url_for(pager['page_next']['url'])"/>
</t>
</t>
</xpath>
</template>

</odoo>
21 changes: 0 additions & 21 deletions website_canonical_url/views/templates.xml

This file was deleted.

0 comments on commit a81c0b4

Please sign in to comment.