Skip to content

Commit

Permalink
Prefer / over /page/homepage.
Browse files Browse the repository at this point in the history
The root path canonicalized is more SEO and user friendly.
  • Loading branch information
yajo committed Sep 30, 2016
1 parent b98860a commit 1f947d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion website_canonical_url/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'author': "initOS GmbH, Odoo Community Association (OCA)",
'website': "http://www.initos.com",
'category': 'Website',
'version': '8.0.1.0.0',
'version': '8.0.1.1.0',
'license': 'AGPL-3',
'depends': [
'website',
Expand Down
7 changes: 7 additions & 0 deletions website_canonical_url/models/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ def get_canonical_url(self, req=None):
# change the path of the url
url_parts[2] = lang + url_parts[2]
canonical_url = urlunparse(url_parts)
# Special case for rerouted requests to root path
try:
if (canonical_url.startswith("/page/") and
self.menu_id.child_id[0].url == canonical_url):
canonical_url = "/"
except:
pass
return canonical_url

0 comments on commit 1f947d5

Please sign in to comment.