Hello, I would like to know if there is an ease way to admin the Front and Views metatags. For now I can see that for Views the only way is using the Views UI, but I need a simple and limited admin where a user role can change only the title and description without access to the Views Configuration, Metatag settings or the Context module. Think in a user without knowledge of Drupal or nothing about programming at all.

I'm thinking in create a Taxonomy Vocabulary or Content Type and call it in some way behind the View page to render the metatags.

Or would be great if there is another module that extend this functionality, thanks in advance

Comments

RAFA3L created an issue. See original summary.

DamienMcKenna’s picture

Are the Views pages just custom paths, or are they for node or term pages? If they're for nodes or term pages you could just handle them as normal nodes and terms. Also, if the front page configuration is disabled you can use a node for the front page and then just manage the meta tags from its edit page.

Or do you not want the people even going near the node edit page?

RAFA3L’s picture

Thanks Damien, yes Views have custom paths, like sections displaying lists of contents. For the front is a good idea.

As commented before maybe the solution is create a taxonomy vocabulary to override metatags in views pages.

RAFA3L’s picture

Maybe something like this could help, is not practical but work. Now I can create one node for each section and override the View Page. The admin user can edit only the fields Meta Title and Meta Description, and can't create new nodes or change the node title.

I can't found a better way to make a relation between a node and a view so for now will be hardcoded the name of the node to load it and get the fields.

function custom_module_metatag_metatags_view_alter(&$output, &$instance) {
  if ($instance == "view:pages:page") {
    $nodes = node_load_multiple(NULL, array("title" => "Section X"));
    $node = current($nodes);
    $output['title']['#attached']['metatag_set_preprocess_variable'][0][2] = $node->field_meta_title[LANGUAGE_NONE][0]['value'];
    $output['description']['#attached']['drupal_add_html_head'][0][0]['#value'] = $node->field_meta_description[LANGUAGE_NONE][0]['value'];
  }
}
RAFA3L’s picture

Another option could be using the Viewfield module and make each section has a node and embed the view as a field.

DamienMcKenna’s picture

Status: Active » Closed (won't fix)

Sounds like you have an idea on what to do. You might also check out some of the other Views-related issues that might help.