das Supportforummozilo Forum
Willkommen Gast. Bitte einloggen oder registrieren. Haben Sie Ihre Aktivierungs E-Mail übersehen?

Einloggen mit Benutzername, Passwort und Sitzungslänge

Autor Thema: Canonical Links  (Gelesen 7790 mal)

0 Mitglieder und 1 Gast betrachten dieses Thema.


Offline irrelevant

  • Mitglied
  • *
  • Beiträge: 6
    • Profil anzeigen
Canonical Links
« am: 11. Januar 2011, 21:54:25 »
regarding http://googlewebmastercentral.blogspot. ... nical.html

Mods to 1.11.2 to support this:

In index.php
within    function readTemplate() {
 		global $CAT_REQUEST;
		global $PAGE_REQUEST;

    $HTML = preg_replace('/{LAYOUT_DIR}/', $LAYOUT_DIR, $HTML);
	$restp = "?cat=" . $CAT_REQUEST . "&page=" . $PAGE_REQUEST;
$HTML = preg_replace('/{CANONICAL_LINK}/', $_SERVER['PHP_SELF'] . $restp, $HTML);

If you use custom parameters in the URL, as I do, and need to include these, you can add something like this between those two lines:
	foreach ($_GET as $key => $value) {
if (stripos("zoom|goto", $key) !== FALSE) {
$restp .= "&" . $key . "=" . $value;
where zoom|goto is a list of tags that also need to be included.  Or, just specify them all with suitable defaults if they are not already defined - it depends what you are up to!

You will also need to adjust your template.html file for whatever layouts you use.  Just add
    <link rel="canonical" href="{CANONICAL_LINK}" />
in the header, under any other <link> tags in there.

This ensures that your pages only appear once in Google search results, and all popularity scores etc are amalgamated across the various forms that the url can take, e.g.: ... 10_Welcome

are all treated as the same page.

« Letzte Änderung: 01. Januar 1970, 01:00:00 von Guest »


Offline azett

  • Coder
  • Mitglied
  • ****
  • Beiträge: 2396
  • mozilo-Coder a.D.
    • Profil anzeigen
Re: Canonical Links
« Antwort #1 am: 23. Januar 2011, 01:27:01 »
Hi Rob,
this is great, thank you for sharing it with us. [ticket=97:bcix4ba8]I put it on the feature list for version 1.13[/ticket:bcix4ba8] - maybe it will implemented even in 1.12.
« Letzte Änderung: 01. Januar 1970, 01:00:00 von Guest »