I needed to add nodewords support to Panels 2.
There are 2 patches required.
1 for nodewords (attached)
1 for Panels

Mild modification should make it work with Panels v1.

Arguments are parsed from the URL and can be replaced in your meta tags by using %0,%1,%2...

Comments

davidburns’s picture

Here's the Panels patch

http://drupal.org/node/180061

davidburns’s picture

In reference to the post above. DO NOT USE THAT PATCH.

Since Panels Alpha 11 the ability to pass panel information into modules is possible.

davidburns’s picture

StatusFileSize
new5.2 KB

The recent panels upgrade passes the panel object.

This patch accepts works with that upgrade.

davidburns’s picture

StatusFileSize
new6.51 KB

This patch adds help text to the form which explains how to pass arguments from the URL into your Meta Tags.

s.daniel’s picture

subscribing

sirkitree’s picture

+1

Panels2 is now beta. It'd be great if the maintainer could look into this patch now.

rastarr’s picture

Subscribing hoping this module gets updated for Panels :)

Robrecht Jacques’s picture

Did you try the patch? Does it work like expected? Thanks.

davidburns’s picture

There is a new release of this module, the code is there to recognize which version of panels is being used. But it doesn't seem to have a form_alter that puts the meta tags fields inside the Panels form.

I will be checking out head this week to see if I can create a patch for this feature.

New version also did not include argument handling. I'll submit a patch for that as well when I get the above completed.

davidburns’s picture

StatusFileSize
new3.78 KB

Here's the newest patch. Tested and seems to be working just fine w/ Panels 1 and Panels 2

Robrecht Jacques’s picture

Aha, now I understand what you were doing :-)

Some comments though:
1. Why not make:

+    if ($result = db_fetch_array(db_query("SELECT * FROM {panels_page} WHERE did = '%d'", $panel_id))) {
+      return array('type' => 'panels', 'ids' => array($result['did']));
+    }

part of _nodewords_detect_type_and_ids(). In fact, isn't that already part of this?

2. Then

+  /* Panels are tricky so lets do this */
+  if ($type = 'panels' && isset($ids)) {
+    $result = _nodewords_panels_load($ids);
+    $type = $result['type'];
+    $ids = $result['ids'];
+  }

doesn't seem needed.

3. The problem with the form ids that have changed is correct. Will fix that.

4. I suppose

+function nodewords_panels_pre_render($panel_id = NULL) {
+  $tags = nodewords_get('panels', $panel_id->did, TRUE);
+  foreach ($tags as $name => $content) {
+    if (!empty($content)) {
+      $argument = nodewords_get_arguments();
+      foreach ($argument as $key => $phrase) {
+        $content = str_replace('%'.$key, ucwords($argument[$key]), $content);
+      }
+      if($name != 'robots'){
+        drupal_set_html_head('<meta name="' . $name . '" content="' . $content . '" />');
+      }
+    }
+  }
+}

is a call for a hook of panels. But how is this going to work? Would one not have two occurences of the meta tags on panel pages?

I'd prefer some more general solution for arguments. Eg I suppose views also could have arguments. Maybe _nodewords_detect_type_and_ids() should return a array with 'type', 'ids' AND 'arguments'. In _nodewords_prepare() one could then do:

+      $argument = nodewords_get_arguments();
+      foreach ($argument as $key => $phrase) {
+        $content = str_replace('%'.$key, ucwords($argument[$key]), $content);
+      }

I'll look into this again tomorrow ... If my comments don't make sense, please tell me.

Robrecht Jacques’s picture

Version: master » 5.x-1.x-dev

The argument part has not been added, the edit panel_pages part (form_ids etc) has.

Please test 5.x-1.8-rc1 and give feedback. Please test whether you can assign meta tags, whether they show up where you expect them to show up and whether, if you delete the panel, the tags are deleted too.

Once enough people test this, I can look at arguments.

Thanks!

Robrecht Jacques’s picture

Version: 5.x-1.x-dev » 5.x-1.8-rc1
patchak’s picture

Humm hey there I just added an meta info to a regular panel page and it does not seem to "save" the info, since when I check out the source, after clearing the cache, I can't see the meta info actually loading at all. It does work for views tho, but not for panel pages. It does not throw any error, but just does not seem to actually use the info I add there.

I just upgraded to panels beta4 so maybe that's why....

Patchak

summit’s picture

Hi,
Is this panels-argument patch in metatags 1.9?

thanks in advance for your reply!

greetings,
Martijn

avpaderno’s picture

Status: Needs review » Closed (won't fix)

As the Drupal 5 version is not supported anymore, I am changing the status of this report.