Jump to content

canonical url, howto


Owdy

Recommended Posts

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

Link to comment
Share on other sites

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 ..

 

 

.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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! :)

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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