Home » Module, Suchmaschinenoptimierung

Optimale Title-Tags in xt:Commerce

8 Februar 2010 3 Comments

Gestern bin ich eherzufällig auf eine überarbeitete Version der /includes/modules/metatags.php Datei von xt:Commerce gestoßen, welche mit kleinen Modifikationen meinerseits sehr gut läuft

Ich habe gerne vollen Zugriff auf die Title-tags, da es mir ermöglicht in den Artikeldetails nur meinen Text anzuzeigen ist das Skript ideal. Der Produktname wird nicht angezeigt, außer ich schreibe ihn manuel in das Title-Feld.

Die Orginalquelle ist übrigens hier.

Der Title auf der Startseite ist wie gehabt der Shopname.
In den Kategorien und Produkten wird nur der Titel angezeigt, der in den Artikel- bzw. Kategoriedetails im “Meta-Title”-Feld angezeigt wurde.

Ein kleines Beispiel:

Katrgorie Level 1 Title -> Katrgorie Level 2 Title -> Katrgorie Level 3 Title

Würde in der dritten Navigationsebene in einer Kategorie angezeigt werden.
In den Artikeln würde nur der Titel stehen, der im xt:Commerce Administrationsbereich für dieses Produkt festgelegt wurde (die Kategorien nicht).

<meta name="robots" content="<?php echo META_ROBOTS; ?>" />
<meta name="language" content="<?php echo $_SESSION['language_code']; ?>" />
<meta name="author" content="<?php echo META_AUTHOR; ?>" />
<meta name="publisher" content="<?php echo META_PUBLISHER; ?>" />
<meta name="company" content="<?php echo META_COMPANY; ?>" />
<meta name="page-topic" content="<?php echo META_TOPIC; ?>" />
<meta name="reply-to" content="<?php echo META_REPLY_TO; ?>" />
<meta name="distribution" content="global" />
<meta name="revisit-after" content="<?php echo META_REVISIT_AFTER; ?>" />
<meta name="robots" content="noodp" />
<?php
 
if (strstr($_SERVER['PHP_SELF'], FILENAME_PRODUCT_INFO)) {
 
if ($product->isProduct()) {
?>
<meta name="description" content="<?php echo $product->data['products_meta_description']; ?>" />
<meta name="keywords" content="<?php echo $product->data['products_meta_keywords']; ?>" />
<title><?php echo $product->data['products_meta_title'] ?></title>
<?php
 
} else {
?>
<meta name="description" content="<?php echo META_DESCRIPTION; ?>" />
<meta name="keywords" content="<?php echo META_KEYWORDS; ?>" />
<title><?php echo TITLE; ?></title>
<?php
 
}
 
} else {
if ($_GET['cPath']) {
if (strpos($_GET['cPath'], '_') == '1') {
$arr = explode('_', xtc_input_validation($_GET['cPath'], 'cPath', ''));
$_cPath = $arr[1];
} else {
//$_cPath=(int)$_GET['cPath'];
if (isset ($_GET['cat'])) {
$site = explode('_', $_GET['cat']);
$cID = $site[0];
$_cPath = str_replace('c', '', $cID);
}
}
if(empty($_cPath)) $_cPath = intval($_GET['cPath']);
 
if(is_array($arr)) {
rsort($arr);
$r = '';
foreach ($arr as $value) {
$r++;
//echo $value.'_'.$r.'-';
$categories_meta_query = xtDBquery("SELECT categories_meta_keywords,
categories_meta_description,
categories_meta_title,
categories_name
FROM " . TABLE_CATEGORIES_DESCRIPTION . "
WHERE categories_id='" . $value . "' and
language_id='" . $_SESSION['languages_id'] . "'");
$categories_meta = xtc_db_fetch_array($categories_meta_query, true);
if($r==1) $out .= $categories_meta['categories_meta_title'];
else $out .= ' - '.$categories_meta['categories_meta_title'];
}
}
$categories_meta_query = xtDBquery("SELECT categories_meta_keywords,
categories_meta_description,
categories_meta_title,
categories_name
FROM " . TABLE_CATEGORIES_DESCRIPTION . "
WHERE categories_id='" . $_cPath . "' and
language_id='" . $_SESSION['languages_id'] . "'");
$categories_meta = xtc_db_fetch_array($categories_meta_query, true);
if ($categories_meta['categories_meta_keywords'] == '') {
$categories_meta['categories_meta_keywords'] = META_KEYWORDS;
}
if ($categories_meta['categories_meta_description'] == '') {
$categories_meta['categories_meta_description'] = META_DESCRIPTION;
}
if(!is_array($arr)) {
$out = $categories_meta['categories_meta_title'];
}
$categories_meta['categories_meta_title'] = $out;
?>
<meta name="description" content="<?php echo $categories_meta['categories_meta_description']; ?>" />
<meta name="keywords" content="<?php echo $categories_meta['categories_meta_keywords']; ?>" />
<title><?php echo $categories_meta['categories_meta_title'] ?></title>
<?php
 
} else {
if ($_GET['coID']) {
$contents_meta_query = xtDBquery("SELECT content_heading
FROM " . TABLE_CONTENT_MANAGER . "
WHERE content_group='" . intval($_GET['coID']) . "' and
languages_id='" . $_SESSION['languages_id'] . "'");
$contents_meta = xtc_db_fetch_array($contents_meta_query, true);
?>
<meta name="description" content="<?php echo META_DESCRIPTION; ?>" />
<meta name="keywords" content="<?php echo META_KEYWORDS; ?>" />
<title><?php echo $contents_meta['content_heading'].' - '.TITLE; ?></title>
<?php
 
} else {
?>
<meta name="description" content="<?php echo META_DESCRIPTION; ?>" />
<meta name="keywords" content="<?php echo META_KEYWORDS; ?>" />
<title><?php echo TITLE; ?></title>
<?php
 
}
}
}
?>

Hinweis: Die mit * gekennzeichneten Links sind Partnerlinks

Grafikdienstleistungen im Wettbewerb

3 Comments »

  • webi said:

    auf jeden fall eine Verbesserung zum original… :)

  • SEO Module für xt:Commerce Suchmaschinenoptimierung said:

    [...] Kontakt « Optimale Title-Tags in xt:Commerce [...]

  • SEO für Onlineshops: Texte für Google optimieren said:

    [...] Kombinationen gefunden vergessen Sie nicht diese auch in der Metabeschreibung und vor allem in den Title-Tags zu verwenden. Gerade eine Optimierung der Title-Tags kann schon eine gute Wirkung erzielen und [...]

Leave your response!

Um Quelltext in Kommentaren lesbar zu posten nutzt bitte <pre lang="php">EUER CODE</pre>

Um Quelltext in Kommentaren lesbar zu posten nutzt bitte <pre lang="php">EUER CODE</pre>