Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Enforced trailing slash causes issues with Facebook social plugins when migrating. #4828

Closed
fubhy opened this issue Jan 19, 2015 · 6 comments

Comments

@fubhy
Copy link

fubhy commented Jan 19, 2015

Issue Summary

Facebook treats URLs with or without trailing slash as separate URLs. This causes a series of issues with the Facebook Scraper including the Likes counter being reset to 0 when migrating from a blogging platform that does not enforce trailing slashes on blog posts. Redirecting from a URL without a trailing slash to one with a trailing slash does not solve the issue either because Facebook follows all redirects and only looks at the canonical URL of the final destination. Due to this, migrating from other blogging platforms with social plugins is a non-option in some cases.

Steps to Reproduce

Set up a blog with the platform of your choice and publish a post without a trailing slash. "Like" the post on Facebook. Migrate to Ghost (use CloudFlare or the likes to set up your custom URL). Check your "Like" counter on the blog post on Ghost. It will be 0 because of the trailing /.

@ErisDS
Copy link
Member

ErisDS commented Jan 19, 2015

To play devil's advocate here: why do you consider this to be a bug in Ghost?

@fubhy
Copy link
Author

fubhy commented Jan 19, 2015

Because you commented on the other issue that it should be raised as a bug report

#1028 (comment)

If it wasn't for that comment I would have raised it as a feature request "Allow blog posts to be configured to not use a trailing slash".

@fubhy
Copy link
Author

fubhy commented Jan 19, 2015

I guess one could argue that enforcing this URL pattern makes migrating from other blogging platforms impossible without losing Facebook Likes, Google Plus +1's. If that makes this technically makes this a bug is another question. It's a limitation for sure. ;)

@ErisDS
Copy link
Member

ErisDS commented Jan 19, 2015

OK - I think that is a slight misunderstanding, I was trying to get the person who commented to properly raise an issue if one existed - it wasn't at all clear from the comment what he meant - a quick check my end found no obvious issue with the scraper and trailing slashes.

I really don't consider the issue raised here to be a bug in Ghost, as I don't think it is doing anything incorrectly - the URLs are valid and consistent, the canonical URL and structured data is reported correctly and enforcing a slash is a sane thing to do for consistency. There's an automatic 301 from the non-slashed to slashed version of every URL, which solves URL problems in the majority of cases.

Raising a feature request to allow the slashes to be turned off is one course of action, but the amount of work required to make it possible is significant given the size of the underlying problem, and I'm not 100% that having the option is desirable. Further, it is a global change to your blog to solve a migration issue, which doesn't really make sense as it isn't a solution to the migration problem. There are other platforms you might migrate from, like tumblr, which can have IDs in the URL that Ghost is not able to maintain, and therefore the URL is forced to change.

Therefore the correct course of action is to find a way to solve the problem of migrating URLs.

What is needed, is have a way to tell sharing services that the resource they are looking at is one-and-the-same as the resource they have data for. I think this can be done at least for facebook by setting the og:url to the old post. There are ways to do this for other services as well.

It is quite possible (although awkward) to resolve the issue by making modifications to the theme and/or adding extra things to the content of each post. Having a native way to resolve this would be great - it will certainly be very easy with apps and probably one of the first apps it'd be possible to build.

I'm going to ping @cobbspur here as he's got a lot of experience of migrating blogs and solving these issues. Perhaps we can come up with a plan, whether it requires apps, or an external tool to modify the imported posts, etc - and then look at solving it that way.

@fubhy
Copy link
Author

fubhy commented Jan 19, 2015

I really don't consider the issue raised here to be a bug in Ghost, as I don't think it is doing anything incorrectly - the URLs are valid and consistent, the canonical URL and structured data is reported correctly and enforcing a slash is a sane thing to do for consistency. There's an automatic 301 from the non-slashed to slashed version of every URL, which solves URL problems in the majority of cases.

I full heartedly agree. I am not saying that Ghost is at fault here in terms of how it handles the URL. It's just an unfortunate problem that arises due to the differences with the former platform. There isn't really a global consensus on the meaning of trailing slashes. Some say it means that the URL is a directory. But there is no actual standard afaik. However, I am not objecting to the idea of having trailing slashes on all URLs.

What is needed, is have a way to tell sharing services that the resource they are looking at is one-and-the-same as the resource they have data for. I think this can be done at least for facebook by setting the og:url to the old post. There are ways to do this for other services as well.

Sadly, as I understand it (I also tried it with no luck) this is not possible. It might have been a caching issue with Facebook so I can try that again but I think I also hit the refresh button on the URL Scraper Debugger over at Facebook when trying it.

Facebook seems to be the most ignorant of the common services. Twitter has no issue with the 301 redirects at all and correctly identifies the resulting blog post URL as the same as it was before.

Thanks for your time and the thorough answer. Looking forward to hear from @cobbspur :)

@ErisDS
Copy link
Member

ErisDS commented Oct 9, 2015

Closing this as its effectively a bug in facebook rather than in Ghost - other social platforms are able to navigate the 301 redirects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants