diff --git a/_include/Page/Common.php b/_include/Page/Common.php index 54c285c8..dce53fad 100644 --- a/_include/Page/Common.php +++ b/_include/Page/Common.php @@ -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'] diff --git a/_include/Page/HTML.php b/_include/Page/HTML.php index a2d94f4d..5cc235fc 100644 --- a/_include/Page/HTML.php +++ b/_include/Page/HTML.php @@ -112,6 +112,8 @@ public function process_template () $meta_tags[] = ''; if (!empty($page['meta_description'])) $meta_tags[] = ''; + if (!empty($page['canonical_path']) && defined('S2_CANONICAL_URL')) + $meta_tags[] = ''; ($hook = s2_hook('proc_tpl_pre_meta_merge')) ? eval($hook) : null; $replace[''] = implode("\n", $meta_tags);