Prevent Facebook from loading comments from the canonical url? - facebook

I have a Facebook comments plugin loading comments for URLs on example.com (e.g. example.com/sample-post), but it is loading comments for the rel=canonical link that is specified in the page head.
Is there any way to prevent this or force Facebook to load comments from example.com/sample-post?

As #CBroe suggested, updating the og:url fixed this issue, while still keeping canonical intact!
In case anyone here runs into this issue when using The SEO Framework, working code was:
add_filter( 'the_seo_framework_ogurl_output', function( $url, $id ) {
if ( is_singular() ) {
// Change singular URL here.
$url = get_permalink();
} else {
// Change term/taxonomy URL here.
}
return $url;
}, 10, 2 );
Thank you!

Related

TYPO3 Extbase Parameters in Url get ignored. No action is called

I'm writing an extension which checks for the browser version, and if the version isn't supported a hint is showed.
I'm doing this with a typoscript condition, which works well so far. But in the hint is a link for the ignoring. The link should call my action "setSessionParameters" in the controller "BrowserCheck". If the link is clicked the correct url gets called, but the same output as before is shown (the hint). The action is completly ignored. I tried to put in a non existing action, but not even an exception is called, which means for me: It's not checked if the question is allowed in the ext_localconf and neither it gets checked in the controller.
I think the typoscript configuration could be a problem, but I can't find a solution. Can anyone help?
Please see my code below
ext_localconf.php:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'VENDOR.' . $extensionKey,
'browsercheck',
[
'BrowserCheck' => 'setSessionParameter',
],
[
'BrowserCheck' => 'setSessionParameter',
]
);
page.typoscript:
page = PAGE
[session('wcobrowsercheck') == "ignore" || checkInternetExplorer()]
page{
//normal setup
}
[ELSE]
// called setup for hint-case
page >
page = PAGE
page{
typeNum = 0
shortcutIcon = {$files.favicon.path}
10 = FLUIDTEMPLATE
10 {
templateRootPaths {
0 = EXT:my_extension/Resources/Private/Templates/BrowserCheck
}
layoutRootPaths {
0 = EXT:my_extension/Resources/Private/Layouts/BrowserCheck
}
templateName = MainPage
}
includeCSS {
...
}
}
[END]
link call in the template:
<f:link.action controller="BrowserCheck" action="setSessionParameters" extensionName="my_extension" pluginName="browsercheck" arguments="{ignore: 'true'}"> ignore </f:link.action>
I see 2 issues with your setup.
You define the PAGE object twice. And the second time you wipe all previous configuration
I can't see that you have placed the plugin on the page.
As your question targets the second issue, I recommend adding the plugin to the page via typoscript if you want that plugin to be available everywhere.
page = PAGE
// ...
page.999 < tt_content.list.20.extkey_pluginname
Or you use a plugin that is placed on the page as a content element. Both will work. But with the current setup you cannot call the plugin as it's not present on the page.

How can I redirect viewers who are blocked from social networking to an alternative page

I've looked at this Check if Facebook is blocked then redirect to try and help me solve this problem.
I have a web page that has an iframe in that contains my tumblr page. What I want is if someone is at work and social networking is blocked it won't try and load the tumblr in the src of the iframe but load my own page tumblr.htm instead.
so I got this far and realise I don't know what I'm doing really.
function isSiteOnline(url,callback) {
// try to load favicon
var timer = setTimeout(function(){
// timeout after 5 seconds
callback(false);
},5000)
var img = document.createElement("img");
img.onload = function() {
clearTimeout(timer);
callback(true);
}
img.onerror = function() {
clearTimeout(timer);
callback(false);
}
img.src = url+"/favicon.ico";
}
isSiteOnline("http://www.tumblr.com",function(found){
if(found) {
// site is online
window.location.href = 'http://my_page.tumblr.com/';
}
else {
// site is offline (or favicon not found, or server is too slow)
window.location.href = 'tumblr.htm';
}
}
Would this work and what would I put in the src of the iframe tag? would it be src="isSiteOnline" ? and that's where the problem is there are several others on one page (twitter etc.) so I'm fighting a losing battle through lack of experience. Can anyone help?

Sharethis & Addthis

Has anyone figured out how to only increment share counts if the sharing action is completed?
They seem to count clicks.. not completed shares. That isn't a stat that is profoundly meaningful to me.
You can set it so the count displays the 'native' count:
<script type="text/javascript">stLight.options({
publisher:"Your publisher key", nativeCount:true
});</script>
However this only seems to work for Facebook, LinkedIn and a few others. For Twitter, I just replace the ShareThis count with the actual count obtained from the Twitter API, once ShareThis has loaded and the ShareThis markup exists on the page:
var pageUrl = 'http://www.google.com/';
updateTwitter();
function updateTwitter() {
if (jQuery('.st_twitter_vcount .stBubble_count').length > 0) {
jQuery.getJSON('http://urls.api.twitter.com/1/urls/count.json?url=' + pageUrl + '&callback=?',
function(data) {
jQuery(".st_twitter_vcount .stBubble_count").html(data.count);
});
}
else {
setTimeout(function() {
updateTwitter();
}, 50);
}
}
Just change the pageURL variable to the URL you want to display statistics for.
Hope that helps,
Kamal.
Ended up rolling my own. Neither seems to support this.

Facebook share dialog not closing after feed post

I have a feed post JS as follows.
var feedObj = {
method: 'feed',
link: link,
picture: imagelink,
name: name,
caption: caption,
description: description,
redirect_uri: "http://"+(window.location.host)+"/",
next:null,
app_id: appid,
actions: [
{ name: text, link: link }
]
};
function callback(response) {
if(response){
}
}
facebook.ui(feedObj, callback);
How do I make sure the feed dialog that clicked to post closes automatically?
I have noticed that the callback is not fired always and this attempt below does not work always
function callback(response) {
if(response){
facebook.Dialog.remove(facebook.Dialog._active);
}
}
I have got a simple trick to close this dialog box. It is not a good way to do this type of work but it just worked fine for me.
Firstly you have to create a page on your server (e.g. closewindow.aspx) and paste this code in your page's body part.
<script src="js/jquery.js" type="text/javascript"></script>
<script>
$().ready(function() { window.close(); });
</script>
Than set redirect_uri parameter property to this page, like :
redirect_uri=http://www.yousitename.com/closewindow.aspx
Now this time in dialog box, this page will be called as redirecturl and the dialog will be closed automatically on page load.
I know this may be tricky but you know how it feels when got this working.
According to the documentation, next is not a parameter.
I understood that with redirect_uri callback is not being called.
Since redirect_uri is supported by most sdks you need not use it.
DEMO
Hope this helps

Select a single 'featured' post in Tumblr?

I would like my Tumblr homepage to show a single Question/Answer post that is selected by a 'featured' tag, or rather by being the most recent Question/Answer post tagged 'featured'. I don't see any built in Tumblr tags that will do this.
I am using jQuery to get the featured post (n number of them) from a category 'featured' by default. I have implemented this solution to my theme - Purely
Here is a screen-shot (displaying three featured posts)
Add this line 's meta section
<meta name='text:Featured Tag' content='featured' />
Add jQuery library in
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
Add these lines in where you want to display the featured post
{block:IndexPage}
{block:IfFeaturedTag}
<h1 class="featured-subhead">
Featured Posts +
</h1>
{/block:IfFeaturedTag}
{/block:IndexPage}
Add these lines just before the closing tag
{block:IndexPage}{block:IfFeaturedTag}
<script>
var rssurl = '/tagged/{text:Featured Tag}/rss';
$.get(rssurl, function(data) {
$('.featured-subhead').append('<div class="featured-posts">');
var $xml = $(data);
var vari = 0;
$xml.find("item").each(function() {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link").text(),
description: $this.find("description").text(),
pubDate: $this.find("pubDate").text(),
author: $this.find("author").text()
}
vari = vari +1;
if(vari <4){
$('.featured-subhead').append('<div class="featured-post" style="overflow:hidden;"><h2 class="featured-title">' + item.title + '</h2><div class="featured-post-description' + vari + '">' + item.description + '</div><div class="featured-post-link">Read More</div></div>');
//Do something with item here...
}
});
$('.featured-subhead').append('</div>');
});
{/block:IndexPage}{/block:IfFeaturedTag}
You can change if(vari <4){ line according to the numbers of posts you want to display as featured. For example, to display a single post, it would be if(vari <2){ .
I have also added few CSS classes to design the output. This can be declared in segment in
h1.featured-subhead
{
/* Heading of featured post */
}
.featured-posts
{
/* Outer box of all featured posts */
}
.featured-post
{
/* Inner box of each featured post */
}
h2.featured-title
{
/* Heading of each featured post */
}
.featured-post-description
{
/* Description or body of each featured post */
}
.featured-post-link
{
/* Link to Permalink page of each featured post */
}
Here only featured-subhead class is necessary. This must be added to the heading of featured post. jQuery will add the featured posts after that.
How does it work?
No surprises here. Tumblr generates a tag RSS page for each page. By using javascript, I am fetching that specific tag page and displaying 'n' number of elements from the XML elements. Sometimes, Tumblr takes a little more time (I don't know why) to generate the RSS page of newly added tags. Be patient and try to browse your-blog.tumblr.com/tagged/featured/rss page to check it is generated or not.
What you're asking is not a native setting to tumblr, in other words there's no preference setting you can simply check.
In order to do what you describes above, you will either need to edit your current theme code, or code a new theme from scratch.
In order to only show 1 question post, at the top, with a tag of featured, you will need to work with the jQuery/Javascript and the Tumblr API.
It's pretty complex coding, but if you're up for it, head on over to the Tumblr API Codex.
This is a little late, but in case it's of any help: Our free Single A theme has the sticky post feature built in. It's the first (and only) tumblr theme to have it. You can get it here: http://www.tumblr.com/theme/28638 or learn more about it here: http://singleatheme.tumblr.com/. Hope this helps!