Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Owdy Posted May 19, 2015 Posted May 19, 2015 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 May 20, 2015 Posted May 20, 2015 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 .. .
Marcher Technologies Posted May 20, 2015 Posted May 20, 2015 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.
Owdy Posted May 20, 2015 Author Posted May 20, 2015 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!
Owdy Posted May 20, 2015 Author Posted May 20, 2015 Yes, this works data-href="{$record->url()}" How about forums?
Marcher Technologies Posted May 20, 2015 Posted May 20, 2015 Yes, this works data-href="{$record->url()}" How about forums? that method is standardized. $topic->url(), $forum->url(), etc, any node that has a public url will have that method, as will any content item.
Owdy Posted May 25, 2015 Author Posted May 25, 2015 data-href="{$forum->url()}" I dont get it. Now that gives blank page edit got it. should be data-href="{$topic->url()}"
Recommended Posts
Archived
This topic is now archived and is closed to further replies.