I can see my og: tags on the front page, but my views don't inherit from the global settings ... no tags are displayed.

#12 metatag-n1861656-12.patch2.39 KBDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 21 pass(es).
[ View ]
#10 metatag-n1861656-10.patch318 bytesDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 21 pass(es).
[ View ]
#7 metatag-n1861656-7.patch1.38 KBDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 21 pass(es).
[ View ]


Status:Active» Postponed (maintainer needs more info)

What are you using to display meta tags with your Views?

Status:Postponed (maintainer needs more info)» Active

What do you mean? I want metatags to use the global settings ...

@aidanlis: Do you mean that you're expecting the global meta tags to display on Views pages? Are they custom Views pages or are they entity pages being displayed using Views, e.g. taxonomy term pages?

They are custom views pages, and yes it'd be great if the defaults carried through. I see there's work going on in #1804356: Views integration: option to add meta tags within the Views UI which would make this request redundant, so happy for you to mark as duplicate if that's the way forward.

They are custom views pages, and yes it'd be great if the defaults carried through.

That was my expectation too — I expected the global defaults to work on all pages unless a more specific metatag configuration existed (eg. for node pages, user pages, etc.).

Are there any foreseeable issues with switching to this behaviour?

Status:Active» Needs review

This is one possible method to ensure all pages have, at a minimum, the global metatags set:

diff --git a/sites/all/modules/metatag/metatag.module b/sites/all/modules/metatag/metatag.module
index eca7434..0d07d75 100644
--- a/sites/all/modules/metatag/metatag.module
+++ b/sites/all/modules/metatag/metatag.module
@@ -900,6 +900,18 @@ function metatag_page_build(&$page) {
     $page['content']['metatags'] = array();
+  // Always add global metatags. These will be ignored if a more specific
+  // override is provided.
+  $cid = "output:global:" . hash('sha256', $GLOBALS['base_url'] . $_SERVER['REQUEST_URI']);
+  if ($cache = cache_get($cid, 'cache_metatag')) {
+    $metatags = $cache->data;
+  }
+  else {
+    $metatags = metatag_metatags_view('global', array());
+    cache_set($cid, $metatags, 'cache_metatag');
+  }
+  $page['content']['metatags']['global'] = $metatags;
   // The front page has special consideration.
   if (drupal_is_front_page()) {
     $instance = 'global:frontpage';

Edit: Fixed the patch snippet

Category:support» feature
new1.38 KB
PASSED: [[SimpleTest]]: [MySQL] 21 pass(es).
[ View ]

This version is a little cleaner - it only loads the meta tags if nothing was found already. I've tested it with metatag_context and the context-provided tags still load correctly, so I think it'll be fine.

Status:Needs review» Reviewed & tested by the community

Great, I've patched our version of Metatags with the patch in comment 7, and all works as expected for us.

Title:Meta tags module simply does not display tags on viewsAlways display global meta tags (useful for Views pages, etc)

Updating the title to better describe the change being made.

Status:Reviewed & tested by the community» Needs review
new318 bytes
PASSED: [[SimpleTest]]: [MySQL] 21 pass(es).
[ View ]

Because this is potentially a performance drain on pages that may not need it, I've added a variable to control it and documented the new variable in the Fine Tuning section of the README.txt file.

Status:Needs review» Needs work

ARGH. I didn't output the results of "git diff", I output the results of "git status", and I've since reverted the changes.

new2.39 KB
PASSED: [[SimpleTest]]: [MySQL] 21 pass(es).
[ View ]

Re-recreated the functionality and update to the README.txt file. Also, argh.

Status:Needs work» Needs review

Status:Needs review» Fixed


Status:Fixed» Closed (fixed)

Now that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.