seo: add field to control content of robots meta tag (#77697) #59
|
@ -25,6 +25,11 @@ class RobotsTxtForm(forms.Form):
|
|||
class SettingsForm(forms.Form):
|
||||
meta_description = forms.CharField(label=_('Description for indexing'), required=False)
|
||||
meta_keywords = forms.CharField(label=_('Keywords for indexing'), required=False)
|
||||
meta_robots = forms.CharField(
|
||||
label=_('Directives for indexing'),
|
||||
required=False,
|
||||
help_text=_('example: noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex'),
|
||||
)
|
||||
|
||||
|
||||
class EnableForm(forms.Form):
|
||||
|
|
|
@ -45,11 +45,13 @@ class HomeView(FormView):
|
|||
initial = super().get_initial()
|
||||
initial['meta_description'] = get_variable('meta_description').value
|
||||
initial['meta_keywords'] = get_variable('meta_keywords').value
|
||||
initial['meta_robots'] = get_variable('meta_robots').value
|
||||
return initial
|
||||
|
||||
def form_valid(self, form):
|
||||
set_variable('meta_description', form.cleaned_data['meta_description'])
|
||||
set_variable('meta_keywords', form.cleaned_data['meta_keywords'])
|
||||
set_variable('meta_robots', form.cleaned_data['meta_robots'])
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
|
|
@ -257,7 +257,8 @@ ul#id_scopes li {
|
|||
}
|
||||
|
||||
#id_meta_description,
|
||||
#id_meta_keywords {
|
||||
#id_meta_keywords,
|
||||
#id_meta_robots {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue