Skip to content

Commit

Permalink
Support for rel canonical.
Browse files Browse the repository at this point in the history
  • Loading branch information
parpalak committed Apr 6, 2016
1 parent 03fe942 commit 9c6374b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _include/Page/Common.php
Expand Up @@ -297,6 +297,8 @@ private function parse_page_url ($request_uri)
if (S2_USE_HIERARCHY && $parent_num && $page['children_exist'] != $was_end_slash)
s2_permanent_redirect($current_path.(!$was_end_slash ? '/' : ''));

$page['canonical_path'] = $current_path.($was_end_slash ? '/' : '');

$id = $page['id'];
$bread_crumbs[] = array(
'title' => $page['title']
Expand Down
2 changes: 2 additions & 0 deletions _include/Page/HTML.php
Expand Up @@ -112,6 +112,8 @@ public function process_template ()
$meta_tags[] = '<meta name="keywords" content="'.s2_htmlencode($page['meta_keywords']).'" />';
if (!empty($page['meta_description']))
$meta_tags[] = '<meta name="description" content="'.s2_htmlencode($page['meta_description']).'" />';
if (!empty($page['canonical_path']) && defined('S2_CANONICAL_URL'))
$meta_tags[] = '<link rel="canonical" href="' . S2_CANONICAL_URL . s2_htmlencode($page['canonical_path']) . '" />';

($hook = s2_hook('proc_tpl_pre_meta_merge')) ? eval($hook) : null;
$replace['<!-- s2_meta -->'] = implode("\n", $meta_tags);
Expand Down

0 comments on commit 9c6374b

Please sign in to comment.