Hallo Rethus,
man könnte das Modul Contenido-Header erweitern...
Input
Code: Alles auswählen
echo '<strong>Canonical-Tag:</strong><br/>';
$canonical="CMS_VALUE[10]";
if(!is_numeric($canonical)) $canonical="";
echo 'id-art der ursprünglichen Seite: <input size="2" type="text" name="CMS_VAR[10]" value="'.$canonical.'"><br/>
<small>(nur die Zahl eintragen!)</small>';
Output ohne AMR
Code: Alles auswählen
<?php
/* canonical-tag */
$canonical_idart="CMS_VALUE[10]";
if($canonical_idart=="" OR !is_numeric($canonical_idart)) $canonical_idart=$idart;
$params = array(
'idart' => $canonical_idart,
'lang' => $lang
);
// url aus parameter generieren
$url = Contenido_Url::getInstance()->build($params, true);
echo '<link rel="canonical" href="' . $url . '" />';
/**
* $RCSfile$
*
* Description: Display HTML Comment with Infos about Contenido and the Sample Client.
*
* @version 1.0.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2008-04-07
* }}
*
* $Id$
*/
if (!isset($tpl) || !is_object($tpl) || strtolower(get_class($tpl)) != 'template') {
$tpl = new Template();
}
$tpl->reset();
$tpl->generate('templates/contenido_header.html');
?>
erzeugt - wenn keine idart im Input angegeben wurde - im Seitenquelltext
<base href="http://www.meinedomain.de/cms/" />
<link rel="canonical" href="http://www.meinedomain.de/cms/front_con ... t=1&lang=1" />
Wurde eine idart im Input erfasst, sieht der Seitenquelltext so aus:
<base href="http://www.meinedomain.de/cms/" />
<link rel="canonical" href="http://www.meinedomain.de/cms/front_con ... t=3&lang=1" />
Output mit AMR
Code: Alles auswählen
<?php
/* canonical-tag */
$canonical_idart="CMS_VALUE[10]";
if($canonical_idart=="" OR !is_numeric($canonical_idart)) $canonical_idart=$idart;
$url="http://www.meinedomain.de/front_content.php?idart=".$canonical_idart."&lang=".$lang;
echo '<link rel="canonical" href="' . $url . '" />';
/**
* $RCSfile$
*
* Description: Display HTML Comment with Infos about Contenido and the Sample Client.
*
* @version 1.0.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2008-04-07
* }}
*
* $Id$
*/
if (!isset($tpl) || !is_object($tpl) || strtolower(get_class($tpl)) != 'template') {
$tpl = new Template();
}
$tpl->reset();
$tpl->generate('templates/contenido_header.html');
?>
erzeugt - wenn im Input keine andere idart angegeben wurde - im Seitenquelltext
<base href="http://www.meinedomain.de/cms/" />
<link rel="canonical" href="http://www.meinedomain.de/unterpunkt_1/ ... tikel.html" />
Ist allerdings die Frage, ob der href zur base href passt, denn hier wäre das /cms zuviel...
Per $_SERVER['HTTP_HOST'] könnte man zwar
http://www.meinedomain.de ermitteln und dem href voranstellen damit es im Output nicht fix reingeschrieben ist, nur, muss dann bei ARM nicht die base href ohne das "/cms" ausgegeben werden?
Letztlich muss das Linkziel ja lauten "
http://www.meinedomain.de/unterpunkt_1/ ... tikel.html"
Wenn im Input eine idart als eigentlicher Originalartikel angegeben wurde, wird dies im Seitenquelltext erzeugt:
<base href="http://www.meinedomain.de/cms/" />
<link rel="canonical" href="http://www.meinedomain.de/cms/front_con ... 225&lang=1" />
Da klappt also die Übersetzung der URL im AMR nicht mehr.

Obwohl der Verweis auf den Originalartikel ja durchaus richtig ist.