Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Considering the fact that search engines do not index the keywords metatag, I would like to be able to disabe/hide the keywords entry field on edit forms. This would prevent confusion for the editors. Is there currently a way to do so? If not, could it be added as a configuration option (what metatags to allow to be filled in)?
Comments
Comment #1
seancr CreditAttribution: seancr commentedYou can control which fields are available to "editors" by using hook_form_alter.
If you have a module you could do something like
function mymodule_form_alter( &$form, &$form_state, $form_id )
{
if( $form_id == 'page_node_form' )
{
//If you have theme developer module - you can see all the stuff you modify here
//dpm( $form );
//You'll probably want to edit the metatags key
//$form[ 'metatags' ][ ??? ]
}
}
Comment #2
Scott M. Sanders CreditAttribution: Scott M. Sanders commentedI want this too. I have another keywords field with a requested higher char limit so want to hide this one (easily).
Comment #3
DamienMcKennaI marked both of these as duplicates: #1606310: Make Keywords and Description Required, #1782830: How can I do the field Keywords and the field Description mandatory in a specific content type?
Comment #4
DamienMcKennaI marked #1611584: Document how to change meta tag length as a duplicate.
Comment #5
DamienMcKennaDuplicate of #1466292: Document all Metatag's hooks.
Comment #6
remkovdz CreditAttribution: remkovdz commentedIs is already possible in some way to make the description and/or keyword fields required?
Comment #7
DamienMcKennaThis issue was closed in favor of #1466292: Document all Metatag's hooks, lets keep the discussion there.