Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Declaring a display suite layout for a content type causes the meta tag to longer be output to the document head. The meta tag will display fine before any layout is specified for a content type but once you do it won't display again, even if the layout is set to none.
Comment | File | Size | Author |
---|---|---|---|
#17 | works_with_ds-1115158-17.patch | 5.87 KB | Denes.Szabo |
Comments
Comment #1
valthebaldI tried to reproduce this and saw that meta fields are displayed both in head and in body.
Then I went to Administration » Structure » Content types »
and selected 'Hidden' in field format and label position for both description and keywords fields.
After that I visited my page and saw it works as expected.
Not the most elegant solution, but worked for me.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedIf you navigate to the "Layout for node_type in Default" tab at the bottom of the node display page, and then select any of the layouts from the dropdown the "hidden" option for the field format should disappear. It seems like this is where the problem for me comes in. Display Suite removes the hidden format and tries to print the tag to the content area rather than letting it print to the head.
Comment #3
valthebaldCan't reproduce this. Some screenshots please?
Comment #4
valthebaldComment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedI just tested this again to take some screenshots and the issue appears to have resolved itself. Not sure if it was something with the update from 1.3 -> 1.6 or if I was just drunk or something. Sorry for any confusion if it was the later.
Comment #6
valthebaldThanks for your feedback!
Comment #7
pnigro CreditAttribution: pnigro commentedHello,
I wasn't sure if I should open a new issue, but I am experiencing the same problem with meta tags quick 7.x-1.9 and display suite 7.x-1.2. I am using the default meta description and meta keyword fields for each of my content types. The only modification I made was changing the label of each of the fields. I did get the meta description and keyword to appear it head temporarily by unchecking 'hide empty regions' in display suite located at admin/structure/types/manage/[content_type]/display. However, after a few refreshes, the meta tags disappear. I then tried rechecking and then unchecking 'hide empty regions' and the tags don't appear any more. If I uninstall display suite, the default meta description and meta keyword fields appear all of the time. I can't seem to figure out what the problem is. Any help would be much appreciated. Great module by the way.
Thanks,
Paul
Comment #8
valthebaldI don't use display suite a lot, but in any case, try 2.x-dev snapshot - it has support for all kinds of pages, not only entity-based. 1.x-dev is not developed anymore
Comment #9
pnigro CreditAttribution: pnigro commentedThanks for getting back to me. The 7.x-2.0 beta-1 version does play nice with display suite. The only way I was able to get it to work was by deleting the old keyword and description meta fields from 7.x-1.9 and have 7.x-2.0 beta-1 re-create them by attaching node Keyword and description fields at admin/config/search/metatags_quick. I also had to manually delete meta_description and meta_keyword from the {field_config} and {field_config_instance} tables. The downside of this approach is that I had to re-enter all of my keyword and description fields for each entity. Luckily, I did not have that many. I hope this helps someone else.
Thanks again,
Paul
Comment #10
pnigro CreditAttribution: pnigro commentedWell, I thought meta tags quick was working with display suite, but I just noticed today that my ubercart product pages are not outputting the meta tags. I performed a fresh install using the following modules:
Chaos tool suite (ctools) 7.x-1.0-beta1
Display suite 7.x-1.2
Entity API 7.x-1.0-beta10
Meta tags quick 7.x-2.0-dev (2011-Jul-28)
Rules 7.x-2.0-beta2
Ubercart 7.x-3.0-beta4
Views 7.x-3.0-rc1
These are the steps I took to reproduce this issue:
1. Install all above modules
2. Select Keyword and Description for all nodes at admin/config/search/metatags_quick
3. Create a basic page and enter keywords and description
4. View source code of node (keyword and description tags display properly)
With Display Suite (No fields in regions)
5. Visit admin/structure/types/manage/page/display and select 'Layout for page in default'
6. Under Select a Layout, choose any layout and Save
7. Visit basic page node and view source (keyword and description tags display properly)
With Display Suite (fields in regions)
8. Revisit admin/structure/types/manage/page/display and add a field to a region and Save
9. Visit basic page node and view source (keyword and description tags are missing)
With Display Suite (No fields in regions)
10. Revisit admin/structure/types/manage/page/display and remove field from region and Save
11. Visit basic page node and view source (keyword and description tags are missing)
Without Display Suite
12. Visit admin/structure/types/manage/page/display and select 'Layout for page in default'
13. Under Select a Layout, choose None and Save
14. Visit basic page node and view source (keyword and description tags display properly)
The really odd thing is that keywords and descriptions on my current install are displaying properly for all display suite enabled content types, except for ubercart product pages. I am not sure how I was able to get mixed results between content types. Any idea what may be causing all of this?
Thanks,
Paul
Comment #11
valthebaldThanks for such a detailed report, I will dig into this tonight
Comment #12
bleen CreditAttribution: bleen commentedsubscribe
Comment #13
pnigro CreditAttribution: pnigro commentedI have been trying to debug this, but I am getting nowhere fast. I thought it may have been an issue of module weight. Currently ds is 1 and metatags_quick is 0. I changed metatags_quick to 2 to check if ds was overriding metatags_quick, but that didn't work.
Comment #14
pnigro CreditAttribution: pnigro commentedvalthebald, have you had time to look at this? I wish I could help single out the issue, but I am just learning to code.
Thanks,
Paul
Comment #15
Denes.Szabo CreditAttribution: Denes.Szabo commentedThis is not a module weight issue. The ds runs through the ds regions and renders it fields, so if a field does not in a ds region will never display out.
I think we have to move the meta field handling to the metatags_quick_page_build(). The path based metafield handling already there, so it is not a big change.
If you insert the meta fields into a ds region the ds will display out them, but if the ds return value not an empty markup just an empty array() the fields will not display. (metatags_quick_field_formatter_view() "Hide element" lines)
Comment #16
pnigro CreditAttribution: pnigro commentedThank you for the explanation Denes.Szabo. I can't believe I didn't try adding the meta description and keyword fields to a region and then setting their labels to hidden. I assumed they would display in the region. The only downside is that the markup for both fields is displayed in the region, which I can live with until a fix is made in code. Thanks again.
Comment #17
Denes.Szabo CreditAttribution: Denes.Szabo commentedI rewrited this module meta tag inserting part. Now it works with and without ds. I hope it solves issues using this module with panels module too, but I haven't tested it. I tested the node and the path based tags, seems fine.
TODO: Need a little bit work on the comment, taxonomy term and user metatags.
Comment #18
valthebaldAs far as I can see, part of the patch that replaces field_attach_view() is irrelevant (module works the same with or without it). The part that makes the different is the else case:
Comment #19
valthebaldHowever, patch really solves the problem described in the issue. Thing to do: replace node-specific code menu_get_object('node') with generic code, like
Comment #20
Denes.Szabo CreditAttribution: Denes.Szabo commentedYou can change but this function type parameter default value is the 'node'… http://drupalcontrib.org/api/drupal/drupal--includes--menu.inc/function/... (Maybe works for user entity too without type parameter.)
So, as I described in the code comment: this module for the "node" type entity with this patch works with or without ds - but need additional test for panels module. If you approve the solution offered this patch then we have to add handling code for other entity types this module has support already (user, comments, etc.)
Comment #21
valthebaldRight, menu_get_object() default value is 'node', and that's the reason it cannot be used for all entities.
Instead, lower-level menu_get_item() should be used
Comment #22
bensnyder CreditAttribution: bensnyder commentedsub
Comment #23
valthebaldI have reproduced scenarios described in # (thanks to PN!), and after some consideration, it seems this is not really a bug.
The root of the problem is that ds marks all fields (including meta) as hidden.
Solution that works (without any patch):
1. Go to /admin/structure/types/manage/page/display (replace 'page' with content type machine name if necessary)
2. For the meta tag fields, select 'Content' region, '' label location, and default metatags_quick link formatter
This worked for me with various other conditions.
If this helps, I will close this with 'works as designed', but will add a section to the README.txt file
Comment #24
cwithout CreditAttribution: cwithout commented#23 does not apply to the Panels issue (as reported in #1217172: No meta tags on Panels Node or Taxonomy Term pages).
You asked for more detail there and referred to here, but I don't know how to give more detail you except just describing the Panels/Page manager functionality. It doesn't work when you use Panels with the built-in node and taxonomy term pages.
Install Page Manger and Panels. Go to "/admin/structure/pages". Enable "/node/%node" and "/taxonomy/term/%taxonomy_term". For both, create a variant which uses Panels. Use all the defaults and choose any layout you want. Add content (such as node body or term description) . Click "Create variant" then "Update and save". View the taxonomy term pages or node pages source, which has no meta tags even if they were assigned to the node and the taxonomy term.
I tried the patch in #17, but it would not apply to either the 7.x-2.1 release or the current 7.x-2.x-dev.
Comment #25
Denes.Szabo CreditAttribution: Denes.Szabo commented#17 will not work for panels, maybe with #19 fixes. I will try tomorrow make the changes, then share the patch.
(DS and maybe panels too use other method to display fields, so simply add a new field will not work.)
Comment #26
valthebald#25: did you try #23 scenario? It helped in my case
Comment #27
Denes.Szabo CreditAttribution: Denes.Szabo commentedI just tried it now. Not helped to my site, there are no meta description in the html.
Comment #28
rvolkHere is a working solution:
http://drupal.org/node/1284852#comment-5691184
Feedback would be appreciated!
Comment #29
valthebald#28: so, can your solution be incorporated into metatags_quick or metatag, or it works only as a separate module/theme?
Comment #30
Taxoman CreditAttribution: Taxoman commented