Problem/Motivation

Meta tags appear on both nodes (node/6) and taxonomy term listing pages (taxonomy/term/6) without page manager enabled. But when page manager overrides the output of those pages, meta tags to not display.

node
Turning on panels, page manager, and creating a page manager override of node/%node, adding a variant, placing a content pane for Node: Content (Full node view mode) into the panel, and viewing the page, indeed, does not show the metatags anymore for node.

term
Creating a similar page manager override of /taxonomy/term/%taxonomy_term, adding a variant, placing a content pane for the term (or view) into the panel, and viewing the page, also does not show the metatags anymore for term.

Original Issue

This is not a duplication of #1151938: Panels integration - meta discussion -- this patch allows defining metatag for node, and get them also if Page manager is overring the node view.

Files: 
CommentFileSizeAuthor
#100 panelizer-language-support-1363476-100.patch947 bytesdasha_v
#89 metatag-n1363476-89.patch1.87 KBDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]
#87 metatag-n1363476-87.patch1.21 KBDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]
#85 metatag-n1363476-85.patch1.17 KBDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]
#36 pagemanager_node_override-1363476-36.patch4.91 KBjenlampton
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]
#35 pagemanager_node_override-1363476-35.patch5.08 KBjenlampton
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]
#34 pagemanager_node_override-1363476-34.patch5.08 KBjenlampton
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]
#33 pagemanager_node_override-1363476-33.patch1.87 KBjenlampton
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]
#17 ss2.png24.03 KBnoslokire
#14 metatag-pagamanager-node-override-14.patch759 bytesbradjones1
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]
#1 metatag-pagamanager-node-override-1.patch2.02 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]
metatag-pagamanager-node-override.patch2.01 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]

Comments

StatusFileSize
new2.02 KB
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]

This patch is making sure we capture only the metatags, and not other fields ;)

Hi would also love a patch like this for term override.
Could someone provide that please? Do I need to file a new issue for this?
Greetings, Martijn

Status:Needs review» Needs work

+++ b/metatag.module
@@ -439,6 +441,14 @@ function metatag_field_attach_view_alter(&$output, $context) {
+    if ($context['view_mode'] == '_custom' && $entity_type == 'node') {

Maybe in this line remove the $entity_type == 'node', and it might work for all entities.

Amitaibu,

Thanks for the patch... should I test now or did you want to first make the change that you outlined in comment #3?

--Ben

The patch above didn't quite work for me. It seemed to get the metatag rules to kick in on node panel pages but also randomly made those node panel pages error out with internal server error.

Thanks so much for this - means I can use the metatag module over opengraph meta!

How easy would it be to create a corresponding patch for taxonomy panel overrides?

Unfortunately this patch also worked initially for me, but then seems to randomly give the following browser error:

No data received
Unable to load the webpage because the server sent no data.
Here are some suggestions:
Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.

With no watchdog entries either.

Unfortunately that means I'm back to the opengraph_meta module...

Patch applied but did not work for me either.

I was able to get a memory exhausted error but nothing in watchdog that was useful

We are using latest dev versions of Metatag module, CTools and Panels

Patch did not work for me either.

I use the panels override function almost on every webpage so I will be patiently awaiting the patch for this.

Thanks again for the Hard work.

Title:Integrate with Panels -- node overrideCompatibility with Panels - overridden paths (node, user, taxonomy)
Issue tags:+panels integration

I'd like to refocus this and perhaps hone in on where the problem is and isn't. In my case, nodes overridden with panels have their meta tags properly applied to the HTML, but panel overrides for other entity types such as users and taxonomy terms do not.

I have not tried the patch above as it seems to not be working for most respondents.

Updating title to cast a wider net.

I'm using:
* Meta Tag 7.x-1.x-dev
* Panels 7.x-3.x-dev

@bradjones1

The original post for this page is in regards to the Node Override by Panels.

For me Meta Tags still does not change the Page title or write out the correct HTML when Panels is overriding a Node.

@kclarkson: Apologies if my edit came across as restricting the ticket - I'm just trying to get the scope right. I think it's likely whatever is affecting the node overrides, plus the additional reports of problems with term and user panels, is rooted at the same basic level since they're all D7 entities, etc.

Not denying that it's not working at all for some people, though apparently nodes work for me. If I can figure out why, maybe there's our answer. I'm going to be working on this issue for a client this am and will report back if I can hone in this patch, etc. etc., but any help appreciated!

Status:Needs work» Needs review
StatusFileSize
new759 bytes
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]

So it looks like some of the patch above was already incorporated into -dev, but the one chunk in metatag_field_attach_view_alter() still needed to be incorporated. See attached patch. (With thanks to Amitaibu.)

(Also I incorporated the suggestion in #3 to remove the test for $entity_type.)

On my dev environment metatags on user, term and node objects are all showing through now. Can others test against latest -dev of the module?

Tested, patch applied cleanly and meta tags are now appearing on my Node overriden by the Panels.

These appear to be the 'Global' Meta Tags and not the node specific meta tags at this point. I can live with that for now but it would be nice to see the tags defined in the 'Content' show up as well. Not sure what everyone else thinks

@noslokire, can you be more specific? In my case, at least, the meta tag content that's rendered in the HEAD of the page is specific to that particular node - it's even working for tokenized content (e.g., a field or [node:summary], if it's set.) There's a meta tags fieldset on the node edit page where you can override the global defaults.

What do you mean by "tags defined in the content?" I'm not an expert on everything the module does so maybe I'm missing something obvious.

Also feel free to move the ticket to RTBC if you think it's ready for a closer look by maintainers for a commit. :-)

StatusFileSize
new24.03 KB

Sure, no problem.

So I have a Content Type of Basic Profile Info that I am using Panels to display.

I have attached my Meta Tags settings, with the "Global" fieldset and "Content" fieldsets expanded.

When I go the a piece of content, I am getting the meta tags defined in the "Global" fieldset, but the items defined in the "Content: Basic Profile Info" fieldset do not. For example, I have hard-coded the word "Something" to appear, but it still won't.

If the patch's intent was to get the Global tags to appear, then it works for me. Otherwise we are missing the "Content" portion.

Hope that helps!

@noslokire, looks like that may be similar to #1306310: "Content" and "Content: type" default meta tag configuration and separate from this issue?

Status:Needs review» Reviewed & tested by the community

Doesn't look to be the same, I can get the description of the non-overridden Panel on one node type but not the overridden node. I can also disable the Panel display and see the description.

@bradjones,

What noslokire described is what I thought what the original issue described.

So yes, the global meta's work but not the content specific when panels is overriding.

Thanks in advance.

I tried both patches. Some things that I learned:

1. In, metatag_page_build(), the first if statement checks for $page['content'] and returns if not there. Both panels do NOT have this element defined-- even the one that is showing the meta tags. I commented out this code and I am now seeing meta tag information on all my nodes. This could explain this working for some people and not others, because it was working fine for in the node override for one content type, but not another.

2. When changing the if clause to accept full and _custom content, I started to get memory allocation errors on my term override pages. I have 128 MB of memory configured, that should be plenty.

3. I thought the reason why it's running out of memory was because metatag_field_attach_view_alter() is being called for every node and term on the page. If you have a sizable panel layout, this is going to cause quite a load. But I was able to largely eliminate that concern, but it might have to do with the architecture in general. The maintainer those providing patches are going to have to take this use case into consideration, I am not familiar enough with the architecture.

Status:Reviewed & tested by the community» Active

from what I can tell this is still an issue. Changing to active.

I am experiencing same behavior as noslokire. Thanks for your effort

Having the same issue. Thanks.

I experience the same issue as noslokire. My node types overridden by Panels got only the "Global" metadata, not the specific ones for the node type. Disabling the Panel display node type specific metadata come back.

Any news about how to fix it?

Same behaviour for me. Would love to see a fix. Meta tags are still very important.
Thanks a lot in advance.
greetings, Martijn

Title:Compatibility with Panels - overridden paths (node, user, taxonomy)Panels integration - ensure meta tags load correctly on page manager pages
Issue tags:+D7 stable release blocker

Closed #1498730: Panels integration - ensure meta tags load correctly as a duplicate. Also tagging this as we need it for the first stable release.

Yes, also getting the same behavior. Custom meta tags for node type is much needed. Great to see this tagged for inclusion in stable release.

--Ben

I agree that this is a very important feature and would be great to get this working, many thanks.

To make this work in my environment (alpha-7 release) I had to adapt patch at #1 and then follow @capellic suggestion at #22 so that metatag_field_attach_view_alter() creates $node_metatags when $context['view_mode'] is 'full' additionally to '_custom'.

Issue summary:View changes

issue summary initiative

I managed to apply the patch from #1 to the latest dev branch (with a few changes) and node meta tags are now working. But, I'm not sure I like the idea of tying it to the view mode. It should certainly be tied to the path, right? when the path is node/16 it should always show the meta tags for node 16, even if only the teaser view mode is displayed on the panel.

I also see issues with this approach for taxonomy terms, since the only view mode that is enabled by default is the "default" view mode, and the only view modes that are available to panels do not include the default view mode :/ but I want my meta tags for term 42 to show up on taxonomy/term/42 even if no term entity is shown on that page at all.

And what happens if I put a node with a full view mode on some other random page? I certainly don't want the additional node to take over the metatags of the unsuspecting host page.

I'm going to take another stab at this.

Status:Active» Needs work
StatusFileSize
new1.87 KB
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]

Okay, here's a patch that fixes meta tags for nodes based on path.
terms next.

Status:Needs work» Needs review
StatusFileSize
new5.08 KB
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]

Hm, on further poking, I think hook_field_attach_view_alter is not the right place to assign meta tags to any given page. Lots of entities may not have fields on them: users, terms, etc.

This patch moves the assignment of meta tags to their entities into hook_entity_view, which will work for any entity.

Testing shows that this seems to be working for taxonomy now too, as well as nodes.

StatusFileSize
new5.08 KB
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]

and one more time without whitespace errors.

StatusFileSize
new4.91 KB
PASSED: [[SimpleTest]]: [MySQL] 15 pass(es).
[ View ]

and one more with some cleanup.

@jenlampton: Thanks for getting to that.

@davereid: Is there a specific reason that hook_entity_view() wasn't used?

When will it be merged into the main dev release?

@cesareaugusto: When one of the maintainers also reviews it.

Because taxonomy terms do not invoke hook_entity_view() at all.

Status:Needs review» Needs work

@Dave: then why not do a work-around for Taxonomy Term pages and a cleaner, less problematic solution for other pages?

Bumping this back to Needs Work as it needs to still work for Taxonomy Term pages.

FYI, this would resolve the problem Dave mentions in #40: #1067120: Missing hook_taxonomy_term_view() or hook_entity_view() when viewing a term

Just to share my experience
I'm using "meta tags" module 7.x-1.0-alpha6 in Drupal 7.
My nodes are created through panels page manager, that ovverides the original node/%node.

Meta tags works in my panelized nodes.

I had to add a region in the bottom of the layout content of the panelized "node template".
This region will not be visible on the screen, because in the css file of the theme there is a line like
.nameoftheregion { display:none; }

In this invisible region I just put "rendered content", that is under the option "entity" in the command "add content".
That makes the module works in my panel nodes. For example:
http://www.studioaquilani.it/content/circolare-ministero-della-giustizia...

I've put the patch in #36 through a lot of testing with core and both Panels & Panelizer, and, other than taxonomy term pages, it works great.

I can confirm that the patch in #36 works great with the patch from #73 in #1067120: Missing hook_taxonomy_term_view() or hook_entity_view() when viewing a term.

Status:Needs work» Fixed

I've committed jenlampton's patch from #36 because it's the correct solution and worked quite well.

Lets continue the discussion on taxonomy term pages in #1700160: Support taxonomy term pages until taxonomy supports hook_entity_view().

Status:Fixed» Needs review

I've committed a patch from #1708718: Ensure Meta tags work OOTB with Drupal core that resolves a problem with hook_entity_view().

That said, the whole static caching thing that's used to pass meta tags to hook_page_build() doesn't appear to be working :(

Status:Needs review» Fixed

After further testing this *does* appear to be working.

Status:Fixed» Closed (fixed)

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

I've installed the latest dev version, but my panel pages are still only showing the Global meta data, and not the data for the specific content type that's being overridden. If I disable the panel, metatags work fine, and they also work if I include the render the node content inside the panel (as per previous workaround).

Is there something I'm missing, or something I need to do to get this working with panels that were created before the fix?

Thanks,

Status:Closed (fixed)» Needs work

I can confirm that this doesn't work - I used the latest dev version on node template from Page manager and the tags are not output

I can also confirm that if I add Rendered content to the panel content it starts working.

Status:Needs work» Closed (fixed)

So this is fixed, right?

Status:Closed (fixed)» Needs work

Frustratingly, it isn't working for me on a site I'm building, none of the overwritten tags are loading.

jherencia: no, it cannot be closed. People often use entities directly in panels so this functionality cannot be dependent on the Rendered content being in the panel

Err... no it doesn't appear to be. Based on the original issue, "this patch allows defining metatag for node, and get them also if Page manager is overring the node view." - which it only does if this rendered node is included in the panel - which is seems like a workaround to me. What if I don't want the entire node in the panel?

Has this been committed to a release yet? And which patch is the best patch to follow?

@nfd: The current codebase includes a patch from jenlampton above, but it doesn't appear to always work. I'm going to work on this today, hopefully will have it working by the weekend.

[offtopic]
@meba: Sorry, I thought you forgot to change the status ;).

@DamienMcKenna Thank you!!! :)

@DamienMcKenna THANK YOU !!

Assigned:Unassigned» DamienMcKenna
Status:Needs work» Active

So hook_entity_view() doesn't appear to trigger when using Panels to display entity view pages: #1759422: hook_entity_view never executes

I talked with merlinofchaos about this problem and it ultimately boils down to bugs in CTools - it should be triggering the hooks but it isn't. There are now three related issues to follow, one for each of the three main entities bundled with Drupal core:

I've built a patch for CTools to make nodes work (#1760384: Update node_view.inc to execute the normal Drupal hooks), could someone please help review it? Thanks.

Question for the peanut gallery - should CTools add something to the $node object to indicate that it is being processed by CTools rather than node_show?

I've also built a patch for CTools to make the user_view page work, which could use some additional eyeballs: #1760578: Update user_view.inc to execute all normal Drupal hooks

FYI when you're reviewing the CTools patches linked to above, please remember that there's a separate problem with the page title right now (#1732538: Page title pattern ignored) so please focus on testing the description meta tag or one of the other ones. Thanks.

Hi, I see those threads about node, user and term pages which are great if they would be implemented. How about custom panel pages please?
My website completely consists of custom panel pages which contain views, nodes, blocks etc.. May be the meta tags could be handled the same as the page title.
On Panels you can select which panel-pane should deliver the page title, this would be great functionality also for the meta tags keywords and description using tokens/context.

Thanks a lot in advance for considering also these options!

Greetings, Martijn

Title:Panels integration - ensure meta tags load correctly on page manager pagesPanels integration - ensure meta tags load correctly on overridden entity pages

Adjusted the title to keep a better focus on this issue, there are other issues for other parts of the Panels puzzle.

With just Meta Tags 7.x-1.x-dev, my meta data tags are appearing correctly on node pages in which the layout is being overriden with a custom Panels layout. Titles are another story, which I'll discuss at http://drupal.org/node/1732538 per #70. My titles issue was actually a template issue (with my Omega subtheme).

@drewallen: which panels version are you using? I've tested Drupal 7.15 with Meta Tags 7.x-1.x-dev and Panels 7.x-3.2 (with Chaos tools 7.x-1.2): meta tags are not shown on nodes with a panel override.

I join FiNeX's question to drewallen.
I am using Drupal 7.15 with Meta Tags 7.x-1.x-dev and Panels 7.x-3.3 (with Chaos tools 7.x-1.2) and meta tags are not showing either.
Would love to find a working combination

In order to get this to work you need the following:

  • Metatag 7.x-1.x-dev
  • Panels 7.x-3.3
  • CTools 7.x-1.x-dev and one of the patches from the issues listed in #65 above.

Description and keywords meta tags seems to work correctly now for taxonomy pages showed via panels.
I just applied 2 patches from #69.
Really good work @DamienMcKenna, thank you very match

Solution to make title work correct was found here
http://drupal.org/node/1732538#comment-6526074

@forgottenbas: Please try with the latest -dev codebase, you should only need to patch ctools in order for it to work.

I note down what I see on my websites on pages using panels. Hopefully this is consistent with what everybody is experiencing.

With Drupal 7.16, Meta Tags 7.x-1.0-beta1, Panels 7.x-3.3, Chaos tools 7.x-1.2

  • Meta tags appear in taxonomy and homepage
  • Meta tags do not appear in node page

With the above modules and patching CTools with this

  • Meta tags appear in taxonomy, homepage and node pages

I'd say we are quite close to a solution!

That CTools patch did the trick for me. Thanks! (p.s. for what it's worth,I was on an earlier version of panels (3.2))

Is the CTools patch "official"? Will it be merged into the main release?

@cesareaugusto: We need a response from one of the CTools maintainers.

Hi,

I am using Meta tags: 7.x-1.0-beta1 with Chaos tools: 7.x-1.2, Panels: 7.x-3.3. I am facing issue with Panel Node template. I have override my node pages with panel page -> node_view (/node/%node)

If I check node page without panel, all meta keywords and description works well as those define in Meta tags settings. But after overriding it with panel Node template its not getting render. I tried to follow the above described patches (for meta tags and ctools) but nothing work for me.

any way to do this?

Title:Panels integration - ensure meta tags load correctly on overridden entity pagesPanels integration - ensure meta tags work OOTB on entity pages

Clarifying the title.

Status:Active» Needs review
StatusFileSize
new1.17 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

Similarly to the Views integration, this patch provides a temporary work-around to load meta tags on entity pages built by CTools, I'd appreciate some help testing it. Thanks.

Status:Needs review» Reviewed & tested by the community

I'm Using:

Drupal 7.17
Panels 7.x-3.3
Chaos tool suite (ctools) 7.x-1.2 + patch from #3
Meta tags 7.x-1.0-beta2 + patch from #85

Meta tags are showing up appropriately on my taxonomy term pages!

Thanks @DamienMcKenna for getting to the bottom of this :)

Status:Reviewed & tested by the community» Needs review
StatusFileSize
new1.21 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

A tiny updated patch that corrects the use of array_pop().

@jenlampton: You shouldn't need any patches from #1760584: Update term_view.inc to execute all normal Drupal hooks in order for the latest patch to work, it should work as-is.

StatusFileSize
new1.87 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

A small update that also runs metatag_entity_supports_metatags() on the identified entity type, just to be sure.

Status:Needs review» Fixed

Committed! Thanks to *EVERYONE* for your help with this, especially jenlampton who did the amazing work to rewrite Metatag to use the entity hooks.

Status:Fixed» Closed (fixed)

Version 7.x-1.0-beta3 has been released and includes this work. Am closing this issue in an effort to keep the issue queue clean. Thank you all for your continued help!

Do I understand correctly that Metatag supports only Panel nodes and not Panel pages?

@clashtar: Not just Panel Nodes, but entity pages that are output using Panels.

To add meta tags to custom Panels pages you'll want to take a look at #1498740: Panels integration - meta tags available on variant settings pages.

@DamienMcKenna,
thank you for reply.
Please precise, do you mean that "Panels pages" are "entity pages"?

@clashar: No, Panels pages are different to entity pages. Again, please continue the discussion in the *other* issue.

@DamienMcKenna,
thank you for explanations, I created a new issue: #1856326: Panels pages vs Entity pages (that are output using Panels)

Status:Closed (fixed)» Active

Taxonomy term template works well, but node template do not work
so I should reopen this issue.

d7.22, omega theme, i18n,latest metatag dev module

Status:Active» Closed (fixed)

@bruceci - See #91 - don't re-open long-closed issues. Open a new ticket if you think there is a bug. Thanks.

@bradjones1: Thanks.

@bruceci: I'm working on a patch for #1572474: Add Revisions to Metatags for Entities that will solve a critical problem with the current -dev release, please keep an eye on that issue.

Issue summary:View changes

typo cleanup

Issue summary:View changes
StatusFileSize
new947 bytes

Attached is small patch for the multilingual support on top of #89 (latest dev/beta9).