Last change
on this file since 2810 was
1081,
checked in by chervol, 15 years ago
|
filtered front-page
|
-
Property svn:eol-style set to
native
|
File size:
714 bytes
|
Line | |
---|
1 | ## Script (Python) "qSEO_Canonical" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters= |
---|
8 | ##title=Get Canonical URL |
---|
9 | ## |
---|
10 | |
---|
11 | prop_name = 'qSEO_canonical' |
---|
12 | |
---|
13 | if context.hasProperty(prop_name) and context.getProperty(prop_name): |
---|
14 | return context.getProperty(prop_name) |
---|
15 | else: |
---|
16 | portal = context.portal_url.getPortalObject() |
---|
17 | if portal.hasProperty('canonical_url'): |
---|
18 | rpath = context.portal_url.getRelativeUrl(context) |
---|
19 | if rpath.endswith('index_html') or rpath.endswith('front-page'): |
---|
20 | rpath = rpath[:-11] |
---|
21 | return portal.getProperty('canonical_url') + rpath |
---|
22 | else: |
---|
23 | return context.absolute_url() |
---|
Note: See
TracBrowser
for help on using the repository browser.