Last change
on this file since 1 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1] | 1 | ## Script (Python) "qSEO_CustomMetaTags" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title=Return context's properties prefixed with qSEO_custom_ |
---|
| 9 | ## |
---|
| 10 | |
---|
| 11 | result = [] |
---|
| 12 | added = [] |
---|
| 13 | property_prefix = 'qSEO_custom_' |
---|
| 14 | for property, value in context.propertyItems(): |
---|
| 15 | idx = property.find(property_prefix) |
---|
| 16 | if idx == 0 and len(property) > len(property_prefix): |
---|
| 17 | added.append(property[len(property_prefix):]) |
---|
| 18 | result.append({'meta_name' : property[len(property_prefix):], |
---|
| 19 | 'meta_content' : value}) |
---|
| 20 | |
---|
| 21 | from Products.CMFCore.utils import getToolByName |
---|
| 22 | site_properties = getToolByName(context, 'portal_properties') |
---|
| 23 | if hasattr(site_properties, 'seo_properties'): |
---|
| 24 | names = getattr(site_properties.seo_properties, 'default_custom_metatags', []) |
---|
| 25 | for name in names: |
---|
| 26 | if name not in added: |
---|
| 27 | result.append({'meta_name' : name, |
---|
| 28 | 'meta_content' : ''}) |
---|
| 29 | |
---|
| 30 | return result |
---|
Note: See
TracBrowser
for help on using the repository browser.