By Luiz Guilherme


2011-07-22 18:10:32 8 Comments

Is there any module or some configuration that I can define the meta tags for the views page display in drupal 7 using Views 3.0?

4 comments

@milkovsky 2014-03-16 23:09:52

The Metatag module has views integration from the box since 7.x-1.0-beta2.

Install the metatags_views submodule and you'll get metatag options in the views UI for any views page display (Paul Querol's comment below).

@Paul Querol 2015-04-27 16:31:03

Surprised this answer isn't getting more love... If you're using the metatags module then just install the metatags_views submodule and you'll get metatag options in the views UI for any views page display.

@milkovsky 2015-04-28 08:15:26

Agree. But the answer above was in 2011. There was no metatags_views submodule at that time. You can add the text about metatags_views submodule into my answer if you want.

@leymannx 2015-04-27 16:21:33

If you don't want to use the "Path-Based Metatags" as mentioned earlier you could make the default metatags_quick fields added to the term itself work as desired with the following approach. Here is an example of how I did it with robots and the help of drupal_add_html_head():

/**
 * Implements hook_preprocess_HOOK()
 */
function MYMODULE_preprocess_page(&$vars) {
  // if this is a term page and not being edited
  if (arg(1) == 'term' && is_numeric(arg(2)) && is_null(arg(3))) {
    // if this is a Views page
    $view = (array)views_get_page_view();
    if (!empty($view)) {
      // if metatags_quick robots are set
      $term = taxonomy_term_load(arg(2));
      if (isset($term->meta_robots) && !empty($term->meta_robots[LANGUAGE_NONE][0]['metatags_quick']))

      $element = array(
        '#tag' => 'meta',
        '#attributes' => array(
          'name' => $term->meta_robots[LANGUAGE_NONE][0]['meta_name'],
          'content' => $term->meta_robots[LANGUAGE_NONE][0]['metatags_quick']
        ),
      );
      drupal_add_html_head($element, 'MYMODULE');
    }
  }
}

@DougF 2012-12-29 03:20:42

Most straight forward solution is to add the view as a block inside a node, and then use module like Metatag to place metatags on the node.

Avoids the views integration issue. Also provides benefit of breadcrumbs, menus, pathauto, etc. all easier to set up when page is a node rather than a view.

@Phizes 2013-03-23 18:58:37

Downvote as I don't see this as being feasible in many cases, such as a site which has a few contextual arguments on a view, and the meta needs to differ for different view arguments.

@user842 2011-07-22 18:17:09

The Meta tags quick module allows you to specify Meta tags based on path for your views. If you enable path-based meta tags, you will see 'Edit meta tags' link on the views page (important - not in the views edit screen!).

@Luiz Guilherme 2011-07-23 13:24:14

Nice, I was using the 1.9 version. This feature for tagging a page based on the url is only on 2.0 beta version. Thanks.

@leymannx 2015-04-27 12:35:07

For me it was a "Path-Based Metatags" titled tab on the page itself (frontend). Also had to make sure render($tabs) was printed in page.tpl.php.

Related Questions

Sponsored Content

4 Answered Questions

[SOLVED] Meta Tags on Frontpage

  • 2012-07-20 20:53:28
  • MacLean Fitzgerald
  • 8140 View
  • 3 Score
  • 4 Answer
  • Tags:   7 meta-tags

2 Answered Questions

[SOLVED] Bulk Update Meta Tags?

  • 2013-09-20 15:14:16
  • 2bsharpdev
  • 1535 View
  • 0 Score
  • 2 Answer
  • Tags:   meta-tags

2 Answered Questions

[SOLVED] How to override default meta tags?

  • 2016-12-15 20:29:23
  • mdb1991
  • 1259 View
  • 1 Score
  • 2 Answer
  • Tags:   meta-tags

1 Answered Questions

[SOLVED] Meta tags on Drupal blog home page

  • 2015-01-14 22:07:58
  • Olenka
  • 366 View
  • 0 Score
  • 1 Answer
  • Tags:   meta-tags nodes

2 Answered Questions

[SOLVED] meta tags don't display when not authenticated

  • 2015-07-29 18:09:59
  • Amy
  • 34 View
  • 1 Score
  • 2 Answer
  • Tags:   meta-tags

1 Answered Questions

[SOLVED] How to correctly add meta tags to custom menu items?

  • 2015-02-07 12:56:20
  • coderama
  • 585 View
  • 0 Score
  • 1 Answer
  • Tags:   7 meta-tags

3 Answered Questions

[SOLVED] meta tags not appearing

  • 2012-07-11 13:52:08
  • user269867
  • 4286 View
  • 0 Score
  • 3 Answer
  • Tags:   7 meta-tags

3 Answered Questions

[SOLVED] How to reorder meta tags in Drupal 7

  • 2013-06-24 07:02:21
  • Syed Hashim
  • 1424 View
  • 7 Score
  • 3 Answer
  • Tags:   7 theming meta-tags

1 Answered Questions

[SOLVED] Canonical URL Meta Tag for a View Page

  • 2012-03-01 14:54:16
  • kurtismccartney
  • 1687 View
  • 2 Score
  • 1 Answer
  • Tags:   views meta-tags

Sponsored Content