I do not want to use the D7 Metatag or the MetaTag Quick modules. How can I specify a single canonical link rel for a single URL which is not a node (a view page) via the theme's template.php?
I've tried this but it has a syntax error:
if (isset($_GET['q']) && preg_match("/^products\category/", $_GET['q']) {
drupal_add_html_head(array(
"#tag" => "link",
"#attributes" => array(
"rel" => "canonical",
"href" => "https://domain.com/products/category",
),
), 'link_rel_canonical');
}