Skip to content

Commit 47163a5

Browse files
authored
Merge pull request #27 from kitconcept/seo-widget
Add new widget for title and description
2 parents 4bd0925 + 5584188 commit 47163a5

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

news/+widget.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add new widget for seo title and description. @iFlameing

src/kitconcept/seo/behaviors/seo.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from kitconcept.seo import _
2+
from plone.autoform import directives
23
from plone.autoform.interfaces import IFormFieldProvider
34
from plone.dexterity.interfaces import IDexterityContent
45
from plone.namedfile.field import NamedBlobImage
@@ -28,20 +29,36 @@ class ISeo(model.Schema):
2829
],
2930
)
3031

32+
directives.widget(
33+
"seo_title",
34+
frontendOptions={
35+
"widget": "softTextWidget",
36+
"widgetProps": {"softMaxLength": "55"},
37+
},
38+
)
39+
3140
seo_title = schema.TextLine(
3241
title=_("Title"),
3342
description=_(
3443
"Override the meta title. When empty the default title will "
35-
+ "be used. Use maximum 50 characters."
44+
+ "be used. Use maximum 55 characters."
3645
),
3746
required=False,
3847
)
3948

49+
directives.widget(
50+
"seo_description",
51+
frontendOptions={
52+
"widget": "softTextareaWidget",
53+
"widgetProps": {"softMaxLength": "155"},
54+
},
55+
)
56+
4057
seo_description = schema.TextLine(
4158
title=_("Description"),
4259
description=_(
4360
"Override the meta description. When empty the default "
44-
+ "description will be used. Use maximum 150 characters."
61+
+ "description will be used. Use maximum 155 characters."
4562
),
4663
required=False,
4764
)

0 commit comments

Comments
 (0)