Welcome Guest, Not a member yet? Register   Sign In
Canonical Tag set
#2

I set it in a controller as a header variable:

PHP Code:
$header_data['canonical'] = 'home'

And in the view

PHP Code:
<?php if(!empty($canonical)) echo '<link rel="canonical" href="'.site_url($canonical).'">'?>

However, I only use it for pages like the home page where it can have several routes into it. perhaps this could be made dynamic using current_url() as described here: https://www.codeigniter.com/user_guide/h...urrent_url

However I am not sure if current_url returns the used url or the full url.

So not really an answer, just an idea about how it might be done.

Best wishes,

Paul.
Reply


Messages In This Thread
Canonical Tag set - by micheal - 02-05-2017, 01:56 PM
RE: Canonical Tag set - by PaulD - 02-06-2017, 11:37 AM
RE: Canonical Tag set - by alpharay - 07-05-2018, 06:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB