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

Number Nine’s picture

Thanks 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 ...:

$term = taxonomy_term_load(arg(2));
$title = $term->metatags['und']['title']['value'];

... 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!

Number Nine’s picture

Well, 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.

Number Nine’s picture

This is the corrected code:

<?php 
$term = taxonomy_term_load(arg(2));
$titolo = $term->metatags['und']['title']['value'];
if ($term->metatags['und']['title']['value'] =="") {?><title><?php print $term->name; ?></title><?php }
else if ($term->metatags['und']['title']['value'] =="[term:name] | [site:name]") {?><title><?php print $term->name; ?></title><?php }
else {?><title><?php print $titolo; ?></title><?php }
?>

Now if I input a customized title, it is rendered. If I do not, the $term->name is rendered.

DamienMcKenna’s picture

What file did you add that code to? Are you using anything custom to manage the taxonomy term pages - Panels, Views, Display Suite, etc?

Number Nine’s picture

I added that code on top of html--taxonomy--term.tpl.php immediately after the line.

To manage taxonomy I use Meta tags + Views.

tomrenner’s picture

Has 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 ;-)

littlepixiez’s picture

Issue summary: View changes

Hi there! This is an awesome solution! I've just changed the code slightly to suit my needs.

<?php 
$term = taxonomy_term_load(arg(2));
if (empty($term->metatags['und']['title']['value'])) :
    if ($term->vid == "5") : ?>
	  <title><?php print $term->name; ?> Information</title>
	    <?php else: ?>
	  <title><?php print $head_title; ?></title>
    <?php endif; ?>
<?php elseif($term->metatags['und']['title']['value'] == "[term:name] | [site:name]"): ?>
 <title><?php print $head_title; ?></title>
<?php else: ?>
 <?php $titolo = $term->metatags['und']['title']['value'];?>
  <title><?php print $titolo;?></title>
<?php endif; ?>

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!

doronin’s picture

Category: Support request » Bug report

Had 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.

DamienMcKenna’s picture

Status: Active » Closed (cannot reproduce)

Please try the latest stable release or -dev snapshot (v1.5 will be out soon), let me know if the problem persists.

hanoii’s picture