Jump to content

canonical url, howto


Owdy

Recommended Posts

Posted

How do i print canonical url to code?

example

<div class="fb-like" data-href="CANONICAL URL HERE" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>

I wanna put that to articles

Posted

How do i print canonical url to code?

example

<div class="fb-like" data-href="CANONICAL URL HERE" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>

I wanna put that to articles

​.

If you really wanna do this then I guess you need to add the ..

rel="canonical"

before the href="siteURL" ..

Not sure you need to use data-href or href .. maybe try href first ..

Another thing .. if you wanna use it with Facebook then you need to use ..   og:url   ?

canonical is something for search engines and og:url is something Facebook uses ..

 

 

.

Posted

He's trying to use it for a custom Facebook button of some sort.

Assuming you are working from within the record view template, you would use:

$record->url()

to get the url object of the currently viewed database record(without any comment pagination or fragments present, so the canonical URL that is), used or cast as a string will return the URL itself.

Posted

He's trying to use it for a custom Facebook button of some sort.

Assuming you are working from within the record view template, you would use:

$record->url()

to get the url object of the currently viewed database record(without any comment pagination or fragments present, so the canonical URL that is), used or cast as a string will return the URL itself.

Perfekt! :)

Posted
data-href="{$forum->url()}"

I dont get it. Now that gives blank page :o

 

edit got it. should be
 

data-href="{$topic->url()}"

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...