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.
Hello, after hours of reading and testing I found no other way but opening an issue.
I am using Drupal 7.23 + Meta Tag 7.x-1.0-beta7 + Internationalization 7.x-1.10 (all latest versions).
I cannot have title and descriptions tags displayed on the taxonomy archive page.
I have had the same problem in the home page, but after inserting the code...
render($page['content']['metatags']);
... in page--front.tpl.php the question was solved.
Nothing changes if I use that code in page--taxonomy--term.tpl.php.
Any suggestion would be appreciated.
Thank you!
Comments
Comment #1
Number Nine CreditAttribution: Number Nine commentedThanks to a friend of mine, Alberto ("The Drupal Knight"!) I found a solution:
1) Open the Taxonomy/Term view and in the Meta Tags area (centre of the page) remove all tokens from the fields Title and Description;
2) Open the html--taxonomy--term page and add the following code before ...:
... and change the title code as:
print $title;
Now what I write in the Meta Tags fields in each taxonomy term field is perfectly visible in the title.
I do not know why, the description tag too is now correct, without any intervention on the code.
Thank you Alberto!
Comment #2
Number Nine CreditAttribution: Number Nine commentedWell, I just found a bug: if you fill in the taxonomy term title with your own title, it is correctly rendered.
But if you do not input any customized title, the sytem does not render automatically the plain taxonomy term, and the tag remains empty.
I am further working on it.
Comment #3
Number Nine CreditAttribution: Number Nine commentedThis is the corrected code:
Now if I input a customized title, it is rendered. If I do not, the $term->name is rendered.
Comment #4
DamienMcKennaWhat file did you add that code to? Are you using anything custom to manage the taxonomy term pages - Panels, Views, Display Suite, etc?
Comment #5
Number Nine CreditAttribution: Number Nine commentedI added that code on top of html--taxonomy--term.tpl.php immediately after the line.
To manage taxonomy I use Meta tags + Views.
Comment #6
tomrenner CreditAttribution: tomrenner commentedHas worked perfectly for me, thank you for your solution!
Just to make things a bit clearer for people that might not immediately figure out: html--taxonomy--term.tpl.php is just an override/duplicate of html.tpl.php
Don't forget to clear cache ;-)
Comment #7
littlepixiez CreditAttribution: littlepixiez commentedHi there! This is an awesome solution! I've just changed the code slightly to suit my needs.
However, a really big issue I have with this is that it doesn't use token replacement inside $titolo. I'm not sure how to make this work...!
Thanks again for your code, it was frustrating to no end as to why they weren't showing up!
Comment #8
doronin CreditAttribution: doronin commentedHad this problem with taxonomy pages that used Views in page display mode to render content. In the view settings there is a section "Meta tags". I went there and changed "Page title" to blank, and it worked. I think there's a problem with default token.
Comment #9
DamienMcKennaPlease try the latest stable release or -dev snapshot (v1.5 will be out soon), let me know if the problem persists.
Comment #10
hanoiiIsn't this mostly related to #2222711: meta tags not working with taxonomy terms (Views page) and #1760494: Allow the page title to be not assigned if it has the value "<none>"?