Pour ce faire, j'ai décidé de me "lancer" en créant mes propres balises d'insertion à l'aide du hook replaceInsertTags de Contao.
Il faut :
1. Récupérer les liens dans le template de la pagination en ajoutant dans le test correspondant :
Code : Tout sélectionner
* /templates/pagination.tpl
...
<?php $GLOBALS['F2']['LINK_REL_PREV']=$this->previous['href']; ?>
...
<?php $GLOBALS['F2']['LINK_REL_NEXT']=$this->next['href']; ?>
...
2. Créer un "pseudo module" de Contao chargé de traiter les tags d'insertion non standard :
Code : Tout sélectionner
* /system/modules/f2/config/config.php
$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = array('F2Hooks', 'f2ReplaceInsertTags');
Code : Tout sélectionner
* /system/modules/f2/F2Hooks.php
<?php
class F2Hooks {
public function f2ReplaceInsertTags($strTag) {
switch ($strTag) {
case 'f2::link_rel_prev': // {{f2::link_rel_prev}}
if ($GLOBALS['f2']['LINK_REL_PREV'])
return '<link rel="next" href="'.$GLOBALS['f2']['LINK_REL_PREV'].'" />';
else
return false;
case 'f2::link_rel_next': // {{f2::link_rel_next}}
if ($GLOBALS['f2']['LINK_REL_NEXT'])
return '<link rel="next" href="'.$GLOBALS['f2']['LINK_REL_NEXT'].'" />';
else
return false;
case 'f2::title_pagination_page_number': // {{f2::title_pagination_page_number}}
if (isset($_GET['page']))
return ' - Page n°'.$_GET['page'];
else
return false;
default:
return false;
}
}
}
?>
3. Modifier le modèle de page pour y insérer les nouvelles balises :
Code : Tout sélectionner
* /templates/fe_page.tpl
<head>
<title><?php echo $this->pageTitle; ?> - <?php echo $this->mainTitle; ?>{{f2::title_pagination_page_number}}</title>
{{f2::link_rel_prev}}
{{f2::link_rel_next}}
...
</head>
Et ça marche
Bon, j'espère que Google saura récompensé tous ces efforts
F2lt