@slavek tue mir doch mal bitte einen Gefallen und füge diese Abfrage in die "CustomizedHeader"-Klasse ein PHP: var_dump(CURRENT_TEMPLATE); und sage mir was bei dir angezeigt wird.
wohin? egal wo? schreibe mir bitte komplette kode... ..... <?php /* -------------------------------------------------------------- CustomizedHeader.php 2016-07-05 Gambio GmbH http://www.gambio.de Copyright (c) 2016 Gambio GmbH Released under the GNU General Public License (Version 2) [http://www.gnu.org/licenses/gpl-2.0.html] -------------------------------------------------------------- */ class CustomizedHeader extends CustomizedHeader_parent { public function prepare_data() { parent:repare_data(); $seoBoost = MainFactory::create('GMSEOBoost'); if ($seoBoost->boost_products && isset($_GET['gm_boosted_product']) && CURRENT_TEMPLATE == 'EyeCandy') { $canonicalUrl = xtc_href_link($seoBoost->callProductsMainCategory($GLOBALS['actual_products_id'])); $this->content_array['CANONICAL_TAG'] = $canonicalUrl; } } }
Zum Beispiel PHP: <?php/* -------------------------------------------------------------- CustomizedHeader.php 2016-07-05 Gambio GmbH http://www.gambio.de Copyright (c) 2016 Gambio GmbH Released under the GNU General Public License (Version 2) [http://www.gnu.org/licenses/gpl-2.0.html] --------------------------------------------------------------*/class CustomizedHeader extends CustomizedHeader_parent{ public function prepare_data() { parent::prepare_data(); $seoBoost = MainFactory::create('GMSEOBoost'); var_dump(CURRENT_TEMPLATE); if ($seoBoost->boost_products && isset($_GET['gm_boosted_product']) && CURRENT_TEMPLATE == 'EyeCandy') { $canonicalUrl = xtc_href_link($seoBoost->callProductsMainCategory($GLOBALS['actual_products_id'])); $this->content_array['CANONICAL_TAG'] = $canonicalUrl; } }} Im Shop müsste nun oben eine Zeile erscheinen, mit einem Inhalt (siehe bild_1), diesen bitte mir sagen.
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de"><head><link href="chrome://imtranslator/content/css/translator.css" id="SL_Style" type="text/css" rel="stylesheet"></head><body>string(15) "IndivCandyGreen"
Danke... diesen Code für "CustomizedHeader"-Klasse übernehmen... PHP: <?php/* -------------------------------------------------------------- CustomizedHeader.php 2016-07-05 Gambio GmbH http://www.gambio.de Copyright (c) 2016 Gambio GmbH Released under the GNU General Public License (Version 2) [http://www.gnu.org/licenses/gpl-2.0.html] --------------------------------------------------------------*/class CustomizedHeader extends CustomizedHeader_parent{ public function prepare_data() { parent::prepare_data(); $seoBoost = MainFactory::create('GMSEOBoost'); if ($seoBoost->boost_products && isset($_GET['gm_boosted_product']) && CURRENT_TEMPLATE == 'IndivCandyGreen') { $canonicalUrl = xtc_href_link($seoBoost->callProductsMainCategory($GLOBALS['actual_products_id'])); $this->content_array['CANONICAL_TAG'] = $canonicalUrl; } }} ....sich über canonical-Tag freuen und somit hast du eine individuelle Anpassung an dein Shop.... Macht dann 2,50€ (gerundet auf vier Dezimalstellen) in die Kaffeekasse der Gambio
im Seitequelltext befindet sich zwischen anderen: <link rel="canonical" href="http://shop.de/artikel.html" />
<link rel="canonical" href="http://www.shop.de/artikel.html" /> <base href="http://shop.de/" /> und wie hast Du geplannt, nur auf Artikelseiten....
Webmastertools zeigte mir: Artikel-Seiten mit doppelten Metabeschreibungen Artikel-Seiten mit doppelten "title"-Tags Wird diese Anpassung "das Problem" in ein paar Wochen selbst loeschen und Webmastertools soll dann keine doppelte Metabeschreibungen zeigen? Oder Webmastertools wird die doppelte Metabeschreibungen weiter melden aber canonical-Tag wird die wichtigste von doppelten URLs an Google zeigen? Soll ich neue sitemap(s) generieren und noch mal melden, oder das ist nicht noetig?
Kommt drauf an, was bei dir als doppelte Metabeschreibung & Co. gelistet wird. Nun ja, mit dem canonical-Tag zeigst du den Suchmaschinen was die Hauptseite eines Artikels ist, wie es sich mit SHORT_URL verhält, wirst du spätestens in einer Woche sehen. Ich glaube, das ist nicht nötig und mit "verkürzten" URL ist die Sitemap eh für die Katz da ich glaube die Sitemap mit kompletter URL generiert wird
@monevo Vielleicht noch eine dumme Frage, aber ich sehe, dass Sitemap generiert diese URLs: Deutsch: http://www.shop.de/de/artikel.html Englisch: http://www.shop.de/en/article.html Spanisch: http://www.shop.de/es/articulo.html Soll canonical-Tag nicht auch die genaue URLs an Google zeigen, also mit /de/ , /en/ , /es/ ...??????? Beispiel: Deutsch: <link rel="canonical" href="http://www.shop.de/de/artikel.html" /> <base href="http://shop.de/" /> Englisch: <link rel="canonical" href="http://www.shop.de/en/article.html" /> <base href="http://shop.de/" /> Spanisch: <link rel="canonical" href="http://www.shop.de/es/articulo.html" /> <base href="http://shop.de/" />
Nein, soweit ich es in Erinnerung habe, ist das ist ein Part von einer anderen Meta-Angabe... Machen wir dann morgen (heute)
Entschuldigung, Ich habe Dir ganze Zeit falsche URLs geschrieben, weil noch Ländercode in URLs integrieren markiert habe, also alle Artikeln im Shop haben URL mit Laendercode: Deutsch: http://www.shop.de/de/artikel.html Englisch: http://www.shop.de/en/article.html Spanisch: http://www.shop.de/es/articulo.html Gute Nacht!
@slavek Bitte diese Code übernehmen: "BugfixGMSEOBoost.php" PHP: <?php/*** Dieser Bugfix behebt die Fehler in der Darstellung und Verlinkung* der Systemkomponenten Artikelnavigator und Breadcrumb.** Mit der Konstante @see const SHORT_URL = false (standard) | true* kann zwischen einer Standardform (false) und Kurzform (true)* der URL für ein Produkt geschaltet werden.** Mein Dank geht an die freundliche Unterstützung der Community Mitglieder:* "barbara", "marmoles" und "Kai Schoelzke".*/class BugfixGMSEOBoost extends BugfixGMSEOBoost_parent{ const SHORT_URL = true; protected $currentCategoryId; protected $output = []; public function __construct() { parent::__construct(); $this->currentCategoryId = $this->currentCategory(); } public function get_boosted_product_url($p_pID, $p_pName = '', $p_language_id = false, $p_url_keywords = '') { $t_language_data_array = $this->get_language_data('product', $p_pID, $p_language_id, $p_url_keywords); if (gm_get_conf('USE_SEO_BOOST_LANGUAGE_CODE') == 'true') { $t_language_data_array['code'] .= '/'; } else { $t_language_data_array['code'] = ''; } $p_pName = $this->get_coolerized_product_name($p_pID, $t_language_data_array['language_id']); $t_link = $t_language_data_array['code']; $t_path = $this->get_product_path($p_pID, $t_language_data_array['language_id']); if ($t_path != '' && self::SHORT_URL === false) { $t_link .= $t_path.'/'; } $t_link .= $p_pName; $t_link .= '.html'; return $t_link; } public function get_product_path($products_id, $languages_id = false) { if ($languages_id === false) { $languages_id = (int)$_SESSION['languages_id']; } $out = ''; $result = xtc_db_query("SELECT categories_id FROM products_to_categories p2c WHERE p2c.products_id = '".(int)$products_id."' AND ".$this->sqlCategoriesId($this->currentCategoryId)." LIMIT 1"); if (xtc_db_num_rows($result) > 0) { $data = xtc_db_fetch_array($result); $out = $this->get_full_categories_names($data['categories_id'], $languages_id); } return $out; } /** * Gibt die SEO spezifische Meta "alternate" und "canonical" Angabe eines Artikels zurück. * * @param null $productsId * * @return mixed */ public function getSeoTags($productsId = null) { $languageProvider = MainFactory::create('LanguageProvider', StaticGXCoreLoader::getDatabaseQueryBuilder()); $activeCodes = $languageProvider->getActiveCodes(); $languageData = $this->get_language_data('product', $productsId); if (gm_get_conf('USE_SEO_BOOST_LANGUAGE_CODE') == 'true') { $languageData['code'] .= '/'; } else { $languageData['code'] = ''; } array_walk_recursive($activeCodes, function ($value) use ($languageProvider, $productsId) { $languageCode = new LanguageCode(new StringType($value->asString())); $languageId = $languageProvider->getIdByCode($languageCode); $alternateUrl = xtc_href_link($this->get_boosted_product_url($productsId, '', $languageId)); if ($languageId != $_SESSION['languages_id']) { $this->output['alternate_url'][strtolower($languageCode)] = htmlspecialchars($alternateUrl); } }); $query = xtc_db_query("SELECT categories_id, gm_url_keywords FROM products_to_categories p2c INNER JOIN products_description pd ON pd.products_id = p2c.products_id WHERE (p2c.products_id = '".$productsId."' AND pd.language_id = '".$_SESSION['languages_id']."') AND ".$this->sqlCategoriesId(null)." LIMIT 1"); if (xtc_db_num_rows($query) > 0) { $data = xtc_db_fetch_array($query); $this->output['canonical_url'] = self::SHORT_URL ? $languageData['code'].$data['gm_url_keywords'].".html" : $this->get_full_categories_names($data['categories_id'], $_SESSION['languages_id']).$languageData['code'].$data['gm_url_keywords'].".html"; } return $this->output; } /** * Workaround um die ID der aktuellen Kategorie zu erfassen. * Mit dieser Information wird der Pfad zum Produkt ermittelt * und an den Breadcrumb übergeben. * * @return int */ protected function currentCategory() { $pathInfo = array_filter(explode('/', $_SERVER['PATH_INFO'])); // Produktseite if (!isset($_GET['cPath'])) { $query = xtc_db_query("SELECT cd.categories_id FROM categories_description cd LEFT JOIN categories c USING (categories_id) WHERE categories_status = TRUE AND gm_url_keywords = '".$this->currentCategoryName($pathInfo)."' AND language_id = '".$_SESSION['languages_id']."' LIMIT 1"); $result = xtc_db_fetch_array($query); if ($result) { $_GET['p2c'] = $result['categories_id']; $_GET['cPath'] = xtc_get_category_path($result['categories_id']); return (int)$result['categories_id']; } return null; } // Kategorieseite return (int)end(explode('_', $_GET['cPath'])); } /** * Workaround um den Namen der aktuellen Kategorie zu erfassen. * Mit dieser Information wird der Pfad zum Produkt ermittelt @see currentCategory * * @param $currentPath * * @return string */ protected function currentCategoryName($currentPath) { if (isset($_GET['gm_boosted_category'])) { $_SESSION['currentCategoryName'] = end($currentPath); return self::SHORT_URL === true ? $_SESSION['currentCategoryName'] : end($currentPath); } if (isset($_GET['gm_boosted_product']) && self::SHORT_URL === true) { return $this->sessionCategoryName($_SESSION['currentCategoryName'], $currentPath); } if (empty($currentPath)) { unset($_SESSION['currentCategoryName']); } return array_reverse($currentPath)[1]; } /** * Workaround um die URL der Hauptkategorie aus der Startseite eines Artikels zu erfassen. * Ist die $_SESSION['currentCategoryName'] bereits belegt, * wird diese für die Darstellung in URL-Kurzform übernommen. * * @param bool $currentCategoryName * @param $currentPath * * @return mixed */ protected function sessionCategoryName($currentCategoryName = null, $currentPath) { if (is_null($currentCategoryName)) { $productsName = trim(str_replace('.html', '', end($currentPath))); $query = xtc_db_query("SELECT cd.gm_url_keywords FROM products_description pd LEFT JOIN products_to_categories p2c USING (products_id) LEFT JOIN categories_description cd USING (categories_id) WHERE pd.gm_url_keywords = '".$productsName."' AND pd.language_id = ".(int)$_SESSION['languages_id']." LIMIT 1"); $result = xtc_db_fetch_array($query); return $_SESSION['currentCategoryName'] = $result['gm_url_keywords']; } return $currentCategoryName; } /** * Legt Anhand der aktuellen Kategorie-ID fest * welche Anweisung für die Datenbankabfrage * festgelegt wird. * * @param $categories_id * * @return string */ private function sqlCategoriesId($categories_id) { if (empty($categories_id)) { return 'p2c.categories_id != 0'; } return 'p2c.categories_id = '.$categories_id.''; }} "CustomizedHeader.php" PHP: <?php/* -------------------------------------------------------------- CustomizedHeader.php 2016-07-05 Gambio GmbH http://www.gambio.de Copyright (c) 2016 Gambio GmbH Released under the GNU General Public License (Version 2) [http://www.gnu.org/licenses/gpl-2.0.html] --------------------------------------------------------------*/class CustomizedHeader extends CustomizedHeader_parent{ public function prepare_data() { parent::prepare_data(); $seoBoost = MainFactory::create('GMSEOBoost'); if ($seoBoost->boost_products && isset($_GET['gm_boosted_product']) && CURRENT_TEMPLATE == 'IndivCandyGreen') { $seoTags = $seoBoost->getSeoTags($GLOBALS['actual_products_id']); $this->content_array['ALTERNATE_URL'] = $seoTags['alternate_url']; $this->content_array['CANONICAL_URL'] = xtc_href_link($seoTags['canonical_url']); } }} "head-USERMOD.html" (siehe bild_1) HTML: {foreach $content_data.ALTERNATE_URL as $url} <link rel="alternate" hreflang="{$url@key}" href="{$url}"/> {/foreach} {if $content_data.CANONICAL_URL} <link rel="canonical" href="{$content_data.CANONICAL_URL}"/> {/if} Caches leeren.. und im Browser die Meta prüfen Das macht dann 10€ in die Kaffeekasse