Skip to content

Commit a98014a

Browse files
committed
[ADD] Añadir campos de SEO - titulo y descripcion | Añadirlo behavior SEO a LRF
1 parent 156d1ff commit a98014a

File tree

6 files changed

+240
-141
lines changed

6 files changed

+240
-141
lines changed

src/genweb6/core/behaviors/seo.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ class ISeo(model.Schema, IDexteritySchema):
2626
"""
2727

2828
model.fieldset(
29-
"seofields", _("SEO"), fields=["seo_robots"],
29+
"seofields", _("SEO"), fields=["seo_title", "seo_description", "seo_robots"],
30+
)
31+
32+
seo_title = schema.TextLine(
33+
title=_("SEO Title"),
34+
description=_("S'utilitza al títol de la secció 'head' de la pàgina web"),
35+
required=False,
36+
)
37+
38+
seo_description = schema.Text(
39+
title=_("SEO Description"),
40+
description=_("S'utilitza a la descripció de la secció 'head' de la pàgina web"),
41+
required=False,
3042
)
3143

3244
seo_robots = schema.Choice(
3345
title=_("Metatag Robots"),
34-
description=_(
35-
"seo_robots_help",
36-
default=(
37-
"Select options that hint search engines how "
38-
"to treat this content. Typically listings are to "
39-
"navigate the site, but add little to no value in its "
40-
"own and should be set to 'noindex, follow'. In some "
41-
"cases you want a listing to be indexed. E.g. when "
42-
"publishing a Top 10 recipes list with extra content "
43-
"above and below the list, in which case you would use "
44-
"'index,follow'."
45-
),
46-
),
46+
description=_("<ul><li><span class='fw-bold'>No value (per defecte):</span> Els motors de cerca indexen la pàgina i segueixen els enllaços (comportament per defecte).</li><li><span class='fw-bold'>index, nofollow:</span> Indexa la pàgina, però no segueix els enllaços que conté.</li><li><span class='fw-bold'>noindex, follow:</span> No indexa la pàgina, però sí que segueix els enllaços.</li><li><span class='fw-bold'>index, follow:</span> Indexa la pàgina i segueix els enllaços (equivalent a no especificar res).</li><li><span class='fw-bold'>noindex:</span> No indexa la pàgina i no segueix els enllaços.</li><li><span class='fw-bold'>noindex, nofollow:</span> No indexa la pàgina ni segueix els enllaços.</li></ul>"),
4747
vocabulary=seoRobotsVocabulary,
4848
required=False,
4949
)
@@ -58,6 +58,22 @@ class Seo(object):
5858
def __init__(self, context):
5959
self.context = context
6060

61+
def _set_seo_title(self, value):
62+
self.context.seo_title = value
63+
64+
def _get_seo_title(self):
65+
return getattr(self.context, 'seo_title', None)
66+
67+
seo_title = property(_get_seo_title, _set_seo_title)
68+
69+
def _set_seo_description(self, value):
70+
self.context.seo_description = value
71+
72+
def _get_seo_description(self):
73+
return getattr(self.context, 'seo_description', None)
74+
75+
seo_description = property(_get_seo_description, _set_seo_description)
76+
6177
def _set_seo_robots(self, value):
6278
self.context.seo_robots = value
6379

0 commit comments

Comments
 (0)