Hi Robrecht,

I am working with Panels 2 (Panels 2 is the great successor of Panels 1.
The great thing of Panels 2 is ...a lot..not just in one sentence to describe.

I noticed that Metatags (Nodewords) is not compatible yet with Panels 2.
Could you please file a patch for this?

Thanks in advance,
greetings,
Martijn

CommentFileSizeAuthor
#8 nodewords_module.txt25.21 KBsummit
#2 panels2.patch1002 bytesjohnalbin

Comments

summit’s picture

Hi,

I read that panels 2 is ready for Meta Tags (http://drupal.org/node/164768), please make Meta tags work with panels 2.
I need this because the meta tags are still used in google to see if a page is unique.

Thanks in advance!

greetings,
Martijn

johnalbin’s picture

Status: Active » Needs work
StatusFileSize
new1002 bytes

In Panels 2.x, the panels_info database table has been renamed to panels_page.

Martijn, if you need a quick fix, you can use the patch I’ve attached. However, the patch isn’t a permanent fix as it would break support for Panels 1.x.

summit’s picture

Hi John,

Thanks for the patch.
I am on holliday in spain.

I think I definitely stay with panels 2.0. It is such a great improvement from panels 1.1.
Earl did a great job for Drupal in my perspective!
Maybe there is a way to make this patch general by building an IF THEN ELSE around the different tables related to the panels version...

Greetings,
Martijn
www.haan.be (I am on holliday here :)

thierry_gd’s picture

Tested the replacement of panels_info by panels_page

==> Works OK, can be applied

najibx’s picture

Title: Meta tags not working on Panels 2.0 » how to add Meta tags in Panels 5.x-2.0-alpha7

I have done the patch. Normally metatag is done on the individual page. In panel/views, where this is done?
Under general setting i.e, admin/build/panel-page/8/edit, I don't see the option there?

summit’s picture

Hi,

I think you are right. The patch is not working.
I think there has to be done more.
The panels_page module should be used instead of panels.module.
I tried to make the changes in nodewords.module but unsuccesfull until now.
I tried to rename:
1) panels_edit_form -> panels_page_edit_form
2) panels_delete_confirm -> panels_page_delete_confirm

but then I am stuck.. I don't know if all the panels should be renamed to panels_page.
I am getting the meta-tags saved to the database, but I am not getting them shown on admin or in the source...
please help!

greetings,
Martijn

summit’s picture

Hi,

I am able to insert the panelpage metatags now, and I am able to save them and get them back on admin page.
I use the PID from the panels_page database-table.
I am still not able to show the filled in metatags in the sourcecode of the panels_page page...and that is what the metatags are ment for right :(

Could somebody please help to build the patch.
My halfway-solution Nodewords-Panels sourcecode is:

function nodewords_form_alter($form_id, &$form) {
  if (!user_access('edit meta tags')) {
    return;
  }
...

  } else if ($form_id == 'panels_page_edit_form') {
    $type = 'panels_page';
    $id = $form['pid']['#value'];
    $form['submit']['#weight'] = 45;
    $form['#submit']['nodewords_panels_handler'] = array();
  } else if ($form_id == 'panels_page_delete_confirm') {
    $form['#submit']['nodewords_panels_handler'] = array();

-------------

/************************************************************
 * Handling of views and panels_page.
 ************************************************************/

/**
 * Handling of edit/delete form for panels_page.
 */
function nodewords_panels_handler($form_id, $form_values) {
  switch ($_POST['op']) {
    case t('Save'):
      if (isset($form_values['nodewords']) && user_access('administer meta tags')) {
        _nodewords_set('panels_page', $form_values['pid'], $form_values['nodewords']);
      }
      break;

    case t('Delete'):
      if ($form_values['confirm']) {
        _nodewords_delete('panels_page', $form_values['pid']);
      }
      break;
  }
}

-------------

/************************************************************
 * Nodewords API functions.
 ************************************************************/
 *   - 'panels_page' => array of 'pid' of the panel

-------------
function _nodewords_prepare($type, $ids, $tags, $filtered = TRUE) {
  $settings = _nodewords_get_settings();

...

else if ($type == 'panels_page' && count($ids) == 1) {
      $panel = db_fetch_object(db_query("SELECT * FROM {panels_page} WHERE pid = %d", $ids[0]));
      if ($panel) {
        $tags['DC.title'] = $panel_page->title;
      }
    }

...

function _nodewords_detect_type_and_ids() {
  if ($_GET['q'] == variable_get('site_frontpage', 'node')) {
    return array('type' => 'page', 'ids' => array(''));
  }

if (module_exists('panels_page')) {
    if ($result = db_fetch_array(db_query("SELECT * FROM {panels_page} WHERE path = '%s'", $_GET['q']))) {
      return array('type' => 'panels_page', 'ids' => array($result['pid']));
    }
  }

please help!
greetings,
Martijn

summit’s picture

StatusFileSize
new25.21 KB

It looks like it is working with the attached sourcecode.
I do not know how to file a patch, sorry for that.
And I do not know if I am correct to use the PID instead of the DID.
The pieces for panels are the same as the above post.
It worked after setting back pathauto from 2.0-dev, to 1.2. I do not know why..but it works now!

Please confirm working of this code and if so please build a patch.
Thanks in advance,
greetings,
Martijn

iaminawe’s picture

subscribe ... looking to do this too

summit’s picture

Version: 5.x-1.5 » 5.x-1.12
Status: Needs work » Fixed

This is implemented in the newest version of Meta tags, differently, but it is working great, so changed to fixed.

greetings,
Martijn

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.