Meta tags completely does not work at my site. Do I need to activate it somewhere?
What I did:
- Install API and UI (did not install Open Graph)
- Added a Meta Tag default for a specific node type
- Changed title to a fix word
- Enabled all checkboxes in "Advanced" (I want to hide that nodetype completely)
- Clicked "Save" and got this Warning: Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1332 of C:\Users\std.BBT\Documents\xampp\htdocs\eeschweiz\drupal\eeschweizd7\includes\bootstrap.inc).
- Looked at a node of that type: The page title did stil show up and also the meta tags.
- Cleared the Cache: Same result
- Disabled all checkboxes in "Advanced", only the title is now set to "something". The Warning is disabpeard.
- Cleared the Cache: The title is not "something", but is the page title. (Which I actually want to hide)
So: Any idea what the problem is?
Comment | File | Size | Author |
---|---|---|---|
#16 | Untitled-1.jpg | 322.47 KB | Anonymous (not verified) |
Comments
Comment #1
majorbenks CreditAttribution: majorbenks commentedI tested this also with the alpha 3. Same result.
So I tried to override the node template. And for all nodes it works fine, except one node type. This nodetype uses an extra tpl.php, so I assume thats the problem! As soon as I override a nodetype, the modul is no longer working properly.
Comment #2
Dave ReidWhat theme are you using? Are you using Display Suite at all or some module that alters the output of nodes? Because the module "outputs" its meta tags inside the node some themes do not properly use render() and will skip output of metatags.
Comment #3
farfanfelipe CreditAttribution: farfanfelipe commentedI am using the ZEN theme but I think that is not a problem related with the theme. After many tests I have the problem when I override the page.tpl.php, the metatags do not show up.
For example: I have a page--front.tpl.php for my homepage, in this case any metatag show up. But, I have a static page that uses the page.tpl.php, in this case the metatags work perfectly.
Comment #4
Dave ReidProbably because your page--front.tpl.php doesn't call
render($page['content']);
I will guess.Comment #5
farfanfelipe CreditAttribution: farfanfelipe commentedNo, I included all type's of render and and it does not work!
Comment #6
Dave ReidCan you PrivatePaste your page--front.tpl.php?
Comment #7
Buckminster_Bond CreditAttribution: Buckminster_Bond commentedHad the same issue (metatags working everywhere, but not the front page) - #4 was the culprit. Thanks Dave!
Comment #8
farfanfelipe CreditAttribution: farfanfelipe commentedHere it is - http://privatepaste.com/537796820e/gokiko
I checked and I see that the variables has been set in the node array for the metatag module but I could not track when It assign the values to the $page[] variable. Thank's Dave Reid!
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedI have the same problem. The meta tags show fine on basic pages but the content type which I'm rendering via Display Suite misses out some of the meta tags (the Drupal 7 generator meta is fine).
For what it's worth; $variables on line 14 of metatag.theme.inc only contains the generator not all the meta tags I would expect. I also can't find where you are calling that theme_metatag from.
Comment #10
ELS Landscape CreditAttribution: ELS Landscape commentedHaving a similar issue with the index page not generating tags.
Using Danland theme an it only has page.tpl.php and I do not see a front.tpl.php in that theme.
I did create a landing page using the wizard in pages with Ctools. I think that is the mod that has the pages wizard.
I searched for a different template but don't see it.
And, the page wizard is not mess with the danland theme for the front page which seems to be all done from single page.tpl.php.
Edit - more investigation shows the front page made with view likely has the theme from views-view.tpl.php
Still not getting on the home page unless I log in but most search engines will not log in lol.
It is showing up on all other pages logged in or not.
Comment #11
greenerr CreditAttribution: greenerr commentedI edited the global tags for my site. The DO NOT work for the main page but do work on every other page. I edited the global: front page tags with the same result.
Any thoughts?
Comment #12
Anonymous (not verified) CreditAttribution: Anonymous commentedI found the solution to my problem here - http://drupal.org/node/1284852
Patch on comment #6 works for me.
Comment #13
ELS Landscape CreditAttribution: ELS Landscape commentedI am not running display suite but I am sure it has to do with whatever template is being generated not calling up the content.
Comment #14
majorbenks CreditAttribution: majorbenks commentedThe title hidding is now working. I did not call render page[content].
But I have still two issues: First, I get this message as soon as I enable the robot preventions: "Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1521 of /home/httpd/vhosts/eemission.ch/subdomains/neu/httpdocs/includes/bootstrap.inc)."
But I don't know, if this message has any consequence.
Second: When I look at the page source (via my browser) I still see the title in a meta content:
(TestMetaTags is the title of the Node) Isn't it possible to turn this completely off?
Comment #15
andrenoronha CreditAttribution: andrenoronha commentedLike #11 it works on every page except for front page.
I unset the content on front page via preprocess_page:
I tested with and without it and it's the same.
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedI still have this very annoying issue. With me it's not working on a custom content type, wich is displayed in a variant (panels) that is selected on this content type. It is working on all pages, except this page.
I also get the error "Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1332 of includes/bootstrap.inc)."".
Meta tags quick are not working either.
At the meta tag settings page, the robots settings are not listed. See this image:
Comment #17
Dave ReidThere is no working integration with panels yet. See #1151938: Panels integration - meta discussion. The PHP notice has already been fixed with #129664: Add setting to disable auto URL aliases for project nodes.
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedThat Post seems to be only for Drupal 6.x.
Comment #19
andrenoronha CreditAttribution: andrenoronha commentedFor any reason after 3 hours or so, it started working.
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedWhat started working? Cache expired ;)?
Comment #21
andrenoronha CreditAttribution: andrenoronha commentedI guess it wasn't cache, cause I had cleaned cache before. And had try running cron manually.
Such a mistery....... o.o
Comment #22
nicolailai CreditAttribution: nicolailai commented#4 Thank you for the tip!
I just placed "render($page['content'])" in two different page--front.tpl.php I've created. And it works.
The metatag module checks for it with an if statement. If it's not set it will return nothing... NOOOTHING!! :-)
Comment #23
Kristen PolI'm having the same problem with alpha4 and bartik theme on D7.9 which does have the proper render function. I have cleared the cache several times. I do have the locale module turned on though and I know there is supposed to be some issue with multilingual sites and metatag but I figured it would show one set of meta tags for all the localized nodes so I was just testing it. But, it doesn't show any of my custom node meta tags.
[update 12/27/11] I created a new content type with translation and named 2 nodes the same alias (English & French) and the custom meta tags show up for those 2 pages. They do not show up for 3 nodes with the same alias that are for node type = 'page'... So, I don't know if this is localization-related or something else entirely.
[update #2] I created more content of content type 'page' and those show the custom meta tags. So... my only guess at this point is that content that was added before turning on the metatag module isn't showing the custom meta tags though that seems weird. Maybe there is something else about those 3 nodes that isn't obvious.
Kristen
Comment #24
SergO CreditAttribution: SergO commented#4, #22 - It works for my Zen-subtheme, thanks.
Comment #25
GNA27 CreditAttribution: GNA27 commentedThe Meta Tag module does not work on my site either. I am using the Jackson theme.
All page titles default to the title in the content type. No descriptions appear in the page source code, and titles do not change despite modifying them by node types in the module.
I have no idea why this is happening. Can someone please post simple instructions that will correct this? I am a relative beginner with Drupal, and I am not very familiar with PHP coding. All I've ever done is edit snippets based on support responses.
So, please, I need something SIMPLE that doesn't require much coding expertise. It always boggles my mind that there is so much customization required just to make some modules and themes functional and useful. The Drupal community desperately needs universal standardization and to start following quality management and control models used in the development of other products.
Comment #26
Kristen PolComment #27
David_Rothstein CreditAttribution: David_Rothstein commentedThis issue is kind of all over the place, but note that one possible explanation for Meta tags not working at all on a site (although a relatively unlikely one) is this: #1434288: Metatags aren't rendered if there are no blocks in the "Content" region
Comment #28
khburres CreditAttribution: khburres commentedI confirm the problem specified at the link provided in #27 worked for me.
Instead of the patch, I simply created an empty block for the content area that only displayed on the front page (
<front>
). Then when I added<?php render($page['content']); ?>
the meta tags displayed.
Comment #29
cblanglois CreditAttribution: cblanglois commentedHello all! I am in the same quandary----ALL MY META TAGS DON'T WORK EXCEPT the front page. What's wrong?
Help would be appreciated.
The solutions provided here have to do with meta tags not working EXCEPT the front page. Mine's the opposite.
Also, there are, in fact, two block in the content region. So that solution doesn't suit me. Help! :)
Comment #30
DamienMcKennaWe need to review this more thoroughly before the stable release.
Comment #31
Dave ReidGoing to move this to a task for now since it's obvious that this does work for some and not for others. It depends on what theme is being used and if it properly renders content.
Comment #32
FrancescoUK CreditAttribution: FrancescoUK commentedStriking factor is Page Titles is able to add the right title to the front page without fiddling with template or php.
Comment #33
Anonymous (not verified) CreditAttribution: Anonymous commentedThere are hundred other ways to achieve that without touching templates...
Comment #34
rovoIn reply to:
http://drupal.org/node/1293214#comment-5084258
Thanks for this hint, this was the issue for me.
I was thinking it would render through
print $head;
Comment #35
b0b CreditAttribution: b0b commentedI also had this issue. But all my page.tpl files had
render($page['content']);
in them and the Main page content block was in the Content area.It turned out to be some custom node.tpl files I had created that caused the problem. Adding
print render($content);
at the bottom of my node.tpl files fixed it for me.Comment #36
Anonymous (not verified) CreditAttribution: Anonymous commentedHello, I created some custom template without the "render($page['content']);", this cause the meta tags to disappear.
I've got 2 questions based on that fact:
1) Is it wrong to not call "render($page['content']);" in a template file?
2) Is there a way to call the meta description, meta tags and title in the template.php to avoid this issue?
Thank you for your help! Great Module!
Comment #37
gonz CreditAttribution: gonz commentedWe are in the same boat - we are still on the uphill part of the learning curve when it comes to Drupal 7 theming (coming from 4-5-6)
We still build node--xxxx.tpl.php files (albeit well organized and pretty complex using entity reference fields and deep rooted field collection data strings)
Problem is we never really render full content either. We build out designs and inject fields and other variables as content into our theme.
This obviously presents the huge problem of no Meta Tags Module.
I gotta have it. SEO is too important. We tried adding the render content snippet and sure enough - it worked like a charm, but added dupe content to my page. No Bueno.
Any advice?
Comment #38
b0b CreditAttribution: b0b commentedI did not get duplicate content when I added the render snippet. Did you put it at the bottom, below the manually rendered fields? I thought render does not include any content that has already been called manually.
Comment #39
Anonymous (not verified) CreditAttribution: Anonymous commented#37: I think so far the best solution is to call the "render($page['content'])" function and then manually hide all the custom fields in Structure -> Content Types -> Manage fields.
Once this is done, you can call all your customs fields manually in the .tpl file with $node->myCustomField[array].
I don't know if this is the best way to do but it works for sure.
Comment #40
gonz CreditAttribution: gonz commentedYou're right - they were not duplicates. On further inspection they were fields that ran through for each loops in my tpl
What you said about not rendering twice is right on the money - starting to gain clarity. Thanks b0b
I wound up using the hide method to directly call out to those fields that were still showing up on my page.
Seemed to work great.
Turns out - only global defaults were working - so after reading another thread, I grabbed the latest DEV and now my custom metatags are fully functional. Stoked.
So is that the trick these days? Hide eveything -> Call render. Then Manually add them render them back into the page. Is there a preference to put the render at the top or bottom of the tpl? (I know that's a themer question for another thread - just thought I would try to squeeze one last bit of advice :)
Comment #41
kumkum29 CreditAttribution: kumkum29 commentedThanks Pairodime,
I followed your solution. The metas are working well. But the solution is not very clean. Is there a module patch to avoid copy this code at the bottom of page?
Thanks.
Comment #42
ThePeach CreditAttribution: ThePeach commentedHad the same issue and I totally agree on what pairodime said in #37 and #40.
The solution is dirty and I can confirm that it works.
Comment #43
stickybeatz CreditAttribution: stickybeatz commentedworks for those of us who do not want to use print render($content);
I put it at the bottom of node.tpl.php and all custom node tpl files
Comment #44
DamienMcKennaRather than hacking away trying to get this working, and ultimately building work-arounds for an existing work-around in Metatag, the output logic has been re-written thanks to jenlampton and I'm hoping it works better now. Please try the latest -dev release and please let me know if it works as-is.
That said, please be aware that right now it doesn't let you override tags for taxonomy term pages due to a core bug, please keep an eye on #1700160: Support taxonomy term pages until taxonomy supports hook_entity_view() for further updates.
Comment #45
DamienMcKennaRelated and honestly a higher priority: #1708718: Ensure Meta tags work OOTB with Drupal core
I'm going to fix that and then see how to resolve this issue.
Comment #46
poorva CreditAttribution: poorva commentedprint render($page['content']['metatags']);
It works for me...
Comment #47
DamienMcKennaThis should work now, between the hook_entity_view change in #1363476: Panels integration - ensure meta tags work OOTB on entity pages, a matching change in the core logic in #1784896: Overriding meta tags fall back to parent default tag value and a stop-gap work-around for a missing hook for taxonomy term pages in #1700160: Support taxonomy term pages until taxonomy supports hook_entity_view(). If you are still having a problem specifically with the front page then it is a theming issue, please get involved with / follow #1800658: Front page settings don't work on some themes (e.g. TopHit).
Comment #48
DamienMcKennaComment #48.0
DamienMcKennaFix grammar
Comment #49
sujoyit2005 CreditAttribution: sujoyit2005 commentedA great tip by Dave Reid #4.
Putting
render($page['content']);
line of code somewhere on the page--front.tpl.php, (preferably after all the necessary content is printed on the page) solved the problem. Now, as the other pages of the website, HOME page also shows META Description and Keywords where website is using Metatag module.Thanks Dave.