Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Anonymous (not verified)
Created:
20 Sep 2011 at 09:42 UTC
Updated:
26 May 2025 at 08:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sebish commentedThat would be great, indeed. Subscribing.
Comment #2
minus commentedSubscribing
Comment #3
Shadlington commentedSubscribing
Comment #4
pazap47 commentedsub
Comment #5
atlea commentedSubscribe
Comment #6
mjpa commentedFound out you can make metatags work with display suite if you manually add the fields via the "Extra fields" setting on admin/structure/ds/extras, but that's a bad way to do things.
Working out how that works, it seems all this module needs to do is add the field to the 'display' context in hook_field_extra_fields(), attaching a patch that does that only if Display Suite is enabled - it may not affect things if the field is always added to the display context though but will need testing.
Comment #7
Anonymous (not verified) commentedGreat, patch works for me.
For others, there is a new field "Meta tag" in the DS content type display setup page. Put the Meta tag field in a visual area (head) and the Meta discription is in the HTML head. Visitors don't see the Meta tag field.
Thanks
Comment #8
biosonic commentedYou saved the day :)
Comment #9
sammyd56 commentedComment #10
atlea commentedRe. testing - have been using this without issues for the past five days. Seems to work great. Thank you. :)
Comment #11
sammyd56 commentedSeems like a resounding RTBC!
Comment #12
heyyo commentedSince I Applyed the patch mentionned in #6 , I successfully get description and og:description inserted in the HTML head, but the image field I set in metatag setting for "Open Graph image: " in a particular content type is not set.
I'm using a media field, and in the devel token tab, my picture is correctly displayed, so the token is filled correctly.
Anyone has this problem too ?
EDIT: I have tested with a regular image field, and the og:image is correctly displayed. So it seems that an updated patch is needed...
Comment #13
dave reidThis probably isn't a good description since these are not actually form elements when being displayed. Maybe something like 'Rendered meta tags' or similar?
Comment #14
mjpa commentedUpdated patch with a better description - should read what I copy/paste in the early hours of the day :)
heyyo: I believe this issue is only about the metatags as a whole not being added to the page, so if there is certain metatags not being added that should be a separate issue.
Comment #16
mjpa commented#14: metatag_ds-1284852-14.patch queued for re-testing.
Comment #17
idflood commentedThe patch in #14 looks good but it doesn't change anything for me. My issue it that both keywords and description doesn't show up in the head. Maybe an update hook missing?
I've cleared all caches, ran update.php, disabled and then enabled the metatag module and finally visited the node type pages in a last desperate move. What did I miss?
Comment #18
idflood commentedsorry, should have read more carefully this issue. Finally followed the guide in #7 and it's working nicely.
This isn't the expected behavior I think, so maybe a little help text somewhere would be good to avoid lots of duplicate issues.
Comment #19
silkogelman commentedApplied the patch at #14 and the instructions at #7.
It works perfectly, all Meta tags show up in the header now (using Display Suite).
Comment #20
Anonymous (not verified) commentedTime for a status change r&tbtc
Comment #21
jyve commentedTested and works great.
I have to say it feels weird that I need to do this just to get header information to work.
Comment #22
glenn_jones commentedThx for the great work guys.
Never the less… i think there is still a problem if you use display suite with the panels UI.
It seems to be unpossible to add the field metatags.
Anybody?
Glenn
Comment #23
Duplika commentedI've updated to the latest dev version and I'm still unable to find the field "Meta tag" at admin/structure/types/manage/mynodetype/display but since I'm only able to place fields in the head area (only enable or disable, example here), maybe I should enable or change something else.
Any ideas will be appreciated.
Comment #24
minus commentedI had to enable the patch in #14, even with the latest dev.
Comment #25
monil-dupe commentedIt is better if patches implement to the main code that we don't need to install patches.
Comment #26
InTheLyonsDen commentedPatch #14 worked for me. Thanks!!!
Comment #27
matthewv789 commentedThis didn't really seem like an ideal solution for me.
First, it requires patching the module itself, which I like to avoid if possible, but will if it offers a complete solution.
Second, it requires manually going in and assigning the meta tags field on each Content Type and View Mode through Display Suite. This can be a lot of work, is easy to overlook, and isn't really intuitive or logical (ie, you're assigning it to some visible region of the page where it's not even showing up).
Third, it doesn't even work in all cases - Panels has already been mentioned, and I had trouble on content types with multiple View Modes. So a good chunk of the pages on my site STILL didn't display meta tags.
So I ended up going a different route, which only modifies my custom theme and works on all pages with no further effort. In my theme's html.tpl.php, I added this PHP code at the top (you could modify this if you have metatags on things besides nodes):
Then just below, I replaced:
with this, which covered the meta tags we were interested in (primarily title tag and meta description) - others could be added as needed:
Comment #28
alwor commentedThanks #27 - just used the bottom part and it worked like a charm with my Omega subtheme + panels, and it even made the Page Title module work for me as well!
Comment #29
sandergo90 commented#27 works like a charm thanks for this but if I may correct it, you better do not do a node_load. It isn't neccessary. When you have the arg(1) you already have your node ID. And if you want to do it even better you put your metatags in a preprocess function like this:
function template_preprocess(&$variables) {
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$node_id = arg(1);
$metatags = metatag_metatags_load('node',$node_id);
$variables['metatags'] = $metatags;
}
}
By this way you can access the variable $metatags in your html.tpl :)
Comment #30
dimitriseng commentedJust to confirm that #14 works for me too, thanks! Is this the final solution then? Or should we look for a more generic solution? I know that there are other issues for integration with panels etc, such as #1212072: Panels Meta.
Comment #31
rvolkI like to share my solution, since i spend round about 10 hours with this issue now. This solution can be used as a module or theme implementation and is definitely not the last solution, but works great for my use case!
Of course the deep linked $vars could be validated if they exists before, but i like to keep this example simple.
As you could see we have to map the metatags from the node entity to the page content metatags. There will be already a global sub array, but the last entry wins. Please remember that the metatags for your node will only be generated in 'full' view_mode!
Feedback would be appreciated!
Comment #32
Katrina B commentedI definitely would like to see a permanent solution for this; I use Display Suite quite a lot -- and I need to be able to have metatags on the sites I work on as well.
Comment #33
danny englanderI have tried #31 above both as a module and template preprocess without success. I'm not a fan of #27 as my theme does not have an html.tpl.php and I don't want to really copy that file over from core into my theme at this point because I am too far into theming my site to introduce a major new page like that with all those alterations, I think the ramifications are far reaching. I don't really have a lot of Display Suite pages in my site, only a few so I'd probably even go back to making a custom node type tpl page instead and ditch Display Suite to get this working.
Therefore, I'd like to try the patch in #14 but I am confused as it's from October 30th 2011 but the latest dev of Metatag is from December of 2011. Did this patch never make it into the dev? If not what dev should I apply the patch against?Thanks.Comment #34
danny englanderOk I applied the patch from #14 and it works but I agree with matthewv789 from #27 above:
This does seem awkward to me to assign a metatag to a visible region i.e. "right" and it says: "Visible", I think that could be confusing for site builders.
Comment #35
carsonblack commentedI can also confirm that #14 works as advertised.
I can also understand #27 issue with UX, but I think the solution proposed there is just too heavy-handed, could introduce the possibility of security issues, make your theme unable to be updated, and, as I understand it, is bad form (Sorry, I don't mean to be a party-pooper or mean spirited I know a lot of people do this kind of thing).
I like where #31 is going, it's the module-side equivalent of what #27 with a little bit of the #29 wants to do, but it only works for one view mode.
Perhaps there is some sort of compromise in all of this? Maybe some kind of choice if ds is detected?
But really I think #14 is the solution to this issue. It works. Thanks mjpa!
Comment #36
slippast commentedThis doesn't appear to have an entry over in the Display Suite queue. Perhaps this could be entered there as a feature request so it could be attacked from the other side? My sense is that this is a Display Suite problem.
Comment #37
BenK commentedYes, I also think that tackling this from the Display Suite side may be best.
Comment #38
mstef commentedWorks
Comment #39
silkogelman commentedRelated issue in Display Suite module issue queue:
#1402402: Metatags from Metatags module
Comment #40
Alex_eav commentedHello,
I'm trying to use patch from #14 but after that my site stopped to work and I see message 'Parse error: syntax error, unexpected '=', expecting ')' in /home2/eav/vodomerka.com.ua/sites/all/modules/metatag/metatag.module on line 621'
May be I'm doing something wrong. Can someone help me?
Comment #41
Anonymous (not verified) commented#14 works! Plain and simple
Comment #42
sircosta commentedAs #40 said, the #14 .patch seems not to work correctly now. An error occurred: "patch unexpectedly ends in middle of line".
So I tried to make it manually with partially success changing de metatag.module.
I'm not an PHP expert so I was testing and finally replace this code in metatag.module (line 652)
by this one:
Making the changes detailed above and following the #7 instructions, 'Meta tags' woks fine in node/% paths but not in taxonomy/term/%. paths.
Any ideas why not working in taxonomy?
Thanks!
Comment #43
vidorado commentedImplementing #31 in template.php works great.
I'm using Omega theme and Display Suite with custom layout in full viewmode. When i configured no layout in the view mode (Drupal default output) metatags showed correctly. But after adding the code i can use whatever Display Suite layout and the metatags show too.
Really, the problem wasn't that i were having no metatags, it was that i was having global metatags instead of the overrided ones for node or my specific node-type.
I'm happy that i haven't had to follow #14 and #7 because i think it's not intuitive and needs too much work setting the Metatag field manually on all nodes.
Thanks R.Volk !!
Comment #44
pipicom commentedAfter I did #14 a new field "Meta tags" appeared at "admin/structure/types/manage/XXXXX/display" according to #7.
So yes, this works for me also..
Comment #45
dropbydrop commentedWhat is ETA for fixing this?
thanks
Comment #46
dropbydrop commentedComment #47
dropbydrop commented#14 and #7 works
when this will be officially fixed?
Comment #48
mjpa commentedI'm going to go with "never will be fixed" unless Dave actually starts checking issues on his modules...
Comment #49
dropbydrop commentedMaybe with to croudfund (gather money) for a developer, or acquia has to look at this more.
We cannot expect a single person have the time to deal with it.
Comment #50
camorim commentedI tried #31 in template.php and it's magic!
Many thanks R. Volk
Comment #51
askibinski commentedpatch in #14 works. Although it feels a bit weird having to place the metatags field in the content.
Comment #52
jackhutton commentedLove the power of being able to customize layout w Display Suite but sacrificing all of the SEO goodness of Metatag makes it a lot less viable.
I used the fix outlined in #31 R. Volk and referenced by #50 camorim and #43 vidorado and
Metatags are specific to the node ; using default mode in display suite are now rendering as expected.
Using an Omega SubTheme
Thank you for the work on metatag module. Its really a critical component.. Look forward to views integration w. metatag as well. I'll keep my eyes open for updates and a possible fix for this issue in a future release..
Again, thanks above and R. Volk for spending 10hrs wracking your brain to arrive at this solution and sharing it with the community.
Comment #53
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, and re-open the issue if it's still not working.
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 #54
maomaohuhu commented7.x-1.0-dev from #53 fixed the problem with Omega subtheme for me. Thanks a lot !
Comment #55
dropbydrop commentedfixed
Comment #56
jackhutton commentedThis is a big deal! Thank You DamienMcKenna , jenlampton and maomaohuhu !
I installed the 7.x-1.x-dev version onto my local development site. Cleaned up the template.php code from above, cleared the caches -
The new version appears to be working great. It preserved my custom tags combinations for content types as well as for the few taxonomy terms
I was having conflicts w. the printer friendly version (print) module and that is no longer an issue as well
So thank you very much for this 'Leg Up' on this critical SEO component .
:)
Comment #57
damienmckennaWith three positive reports I'm going to mark this as being fixed.
Comment #58
jmart commentedI just tried the dev version and it did not work with Display Suite.
Comment #59
damienmckenna@jmart: please provide more details. What types of entities did you test? What theme were you using? Did you make any customizations to the template files? Did you clear the site caches after updating?
Comment #60
jmart commentedThank you Damien for responding.
After further investigation, it's not just Display Suite for the latest 7.x-1.x-dev version. It's not working on any of my nodes. I cleared the cache.
Theme: Custom theme with a Zen 7.x-3.1 base theme
I created two sites, one with recommended alpha and the other with dev. I created two pages, one a "Basic Page" content type and the other a "Animal" content type with a Full Content view mode and a Display Suite layout. I attached my template.php file. They are the same on both sites.
https://metatagalpha.dev.epcsite.com
Metatag version: 7.x-1.0-alpha6
Username: metatag
Password: metatag
https://www.metatagalpha.dev.epcsite.com/about - WORKS
https://www.metatagalpha.dev.epcsite.com/display-suite-giraffe - DOES NOT WORK
AND
https://www.meta-dev.dev.epcsite.com
Metatag version: 7.x-1.x-dev
Username: metatag
Password: metatag
https://www.meta-dev.dev.epcsite.com/about - DOES NOT WORK
https://www.meta-dev.dev.epcsite.com/display-suite-giraffe - DOES NOT WORK
Comment #61
damienmckenna#jmart: Thanks. Did you change anything in the html, page or node tpl files? I wonder if this might be a case of theme incompatibility, but I'll definitely check it out.
Comment #62
jmart commentedI've attached the entire theme.
Comment #63
damienmckenna@jmart: That's awesome, thanks, I'll try to test it this week.
Comment #64
damienmckenna@jmart: Just to see, could you please change to another theme and see if the problem persists? Thanks.
Comment #65
jmart commentedI downloaded and enabled Stark 7.14 and Omega with the same results for both sites.
Comment #66
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 #67
damienmckenna@jmart: Please try the -dev release again (download it on Aug 5th or later, to ensure it has the latest code commits) and let me know if it now works on the homepage and on node pages, this should now work correctly. Thanks.
Comment #68
damienmckenna@jmart: btw I tried out your theme on my d7.dev testbed, and on a node page with an overridden description & title, using the current stable release of DS I get the following meta tags:
Comment #69
checker commentedI have also still problems with ds and meta tags 7.x-1.0-alpha8.
If a node type uses a display suite layout - a node page uses global meta tags configurations.
Switching off display suite layout for the same node type - a node page uses correctly meta tags configurations and not only globals.
Tested with drupal core theme seven. Any ideas how to debug this?
Comment #70
mezitlab commented@DamienMcKenna: Thank You!
I struggled a lot with metatag + ds combo, but the last dev (7.x-1.0-alpha8+10-dev) release seems work well.
@checker: 7.x-1.0-alpha8 doesn't work with ds module. Try to use the dev release!
Comment #71
damienmckennaRe-opening this as I'm not satisfied that it Really Is Working(tm).
Comment #72
checker commentedThank you for your feedback DamienMcKenna.
I tried 7.x-1.x-dev 2012-Aug-26. It is the same situation for me described in #69 (with 7.x-1.0-alpha8).
Comment #73
jawi commentedsame issue here
contenttype with display suite show site wide metatags
Comment #74
jawi commentedsame issue here
contenttype with display suite show site wide metatags
Comment #75
flocondetoileI confirm. I have exactly the same probleme described in #69
With the version 7.x-1.0-alpha8+10-dev
Comment #76
jawi commentedSo we should use metatags_quick
it works with fields!
http://drupal.org/project/metatags_quick
Comment #77
Nightwalker3000 commentedAlso the same issue here which described in #69
I really dont want to Bug you but is there any News? I'm using open graph to show the Image and description in Facebook and now there always shows the default Image
Comment #78
hans_dampfer commentedSubscribing
Comment #79
silkogelman commentedPlease use the follow button to subscribe
http://drupal.org/node/1306444
Comment #80
gagoo commentedHello,
Same as #69 for me :(
Display Suite and Meta Tags modules are essencials to every drupal 7 website in my opinion !
It would be great if they could work fine together :)
Thank you.
Comment #81
damienmckennaIn my limited testing the patch in #1784896: Overriding meta tags fall back to parent default tag value appears to resolve this, could others please help test the patch from the POV of using DS? Thanks.
Comment #82
damienmckennaRemoved an unnecessary tag.
Comment #83
checker commentedPatch #13 from #1784896: Overriding meta tags fall back to parent default tag value fixed the display suite bug. Tested with current dev.
Comment #84
Nightwalker3000 commentedConfirm patch #13 in #1784896: Overriding meta tags fall back to parent default tag value works with newest dev version 7.x-1.0-alpha8+13-dev from 1. Oktober.
Thanks
Comment #85
damienmckennaI've committed the patch from #1784896, so the next dev version should work correctly. Feel free to re-open if it doesn't work.
Comment #86
damienmckennaLast night saw the release of 7.x-1.0-beta1, so I'm closing all these "fixed" issues in the interest of tidying up the issue queue. Thank you all for your help getting us to this point!
Comment #87
malc0mn commented#14 works for me as well. What did not work for me, as mentioned by several people, is when you have view mode other than 'full' and still need metatags to display. The problem is in function metatag_field_attach_view_alter():
There is a check on view_mode here. What I did to get around it is:
Even wanted to create a patch to help ppl. overcome this situation until a 'proper' solution is found, but there is no real place to put the settings form where you can alter the viewmodes. Ideally you ad this to the metatag settings and make an exception for this field => extract the view_modes field, unset it and use it in the above situation.
Comment #88
damienmckenna@malc0mn: Please open a new issue for supporting multiple view modes, I don't want to clutter this closed issue with other discussions. Thanks.
Comment #89
jfeltkamp#14 worked for me.
I had also to disable the option "no extras" in the content-pane properties of my panels content-element.
Comment #90
damienmckenna