Functions:canonicalUrlTag

From Whirlwind eCommerce Wiki
Jump to: navigation, search

Description

canonicalUrlTag() returns a string containing the HTML link tag for the selected canonical url for the page. If no url map is selected as the canonical url, the first url map entered for the page will be used. If no url maps are set for the page, than the system link (index.php?pageId=#) will be used.

Syntax

$canonicalUrlTag = eV::canonicalUrlTag($pageId[,$overrideUrl]);

Paramaters

  • pageId INT
the pageId for the current page. This is already defined as $pageId when a template is processed.
  • overrideUrl STRING
this will override the canonical link creation process, and place this string value into the href attribute for the tag.

Return Values

String containing the HTML link tag for the canonical URL: <link rel="canonical" href="/my-canonical-url-here" />

Example

echo "<html>
<head>
<title>$title</title>";
echo eV::canonicalUrlTag($pageId);
echo "</head>
<body>
$copy
</body>
</html>";