Closed CMCDragonkai closed 9 years ago
Yeah I think I forgot to update the {{encode title}} helper to {{encode meta_title}} so it works on all pages. I'll fix this soon, or you can test it out and submit a PR. Up to you!
@CMCDragonkai I couldn't seem to resolve this so I've opened it up as a bug on the Ghost repo.
Turns out this is a Ghost / HBS issue so refer to the referenced issue above.
Why can't we just do something if it's on the homepage use the blog url, if not, use what's currently there?
As a workaround, you can copy the code into index.hbs
or wherever and change {{encode title}} to {{encode @blog.title}}, but at the current time you can't use the same partial in both contexts.
Could you elaborate, I didn't quite understand what you mean.
Yeah, sorry:
So basically you can use this code on the post page:
<div class="share">
Share this on <a id="twitter" href="http://twitter.com/share?text={{encode title}}&url={{url absolute='true'}}">Twitter</a>, <a id="facebook" href="https://www.facebook.com/sharer/sharer.php?u={{url absolute='true'}}">Facebook</a> or <a id="google-plus" href="https://plus.google.com/share?url={{url absolute='true'}}">Google+</a>.
</div>
But you'll need to use this code everywhere else (homepage, author page, etc):
<div class="share">
Share this on <a id="twitter" href="http://twitter.com/share?text={{encode @blog.title}}&url={{url absolute='true'}}">Twitter</a>, <a id="facebook" href="https://www.facebook.com/sharer/sharer.php?u={{url absolute='true'}}">Facebook</a> or <a id="google-plus" href="https://plus.google.com/share?url={{url absolute='true'}}">Google+</a>.
</div>
The difference is {{encode title}}
vs {{encode @blog.title}}
. This means that you can't use the same partial code (share.hbs
) on both pages due to current issues with Ghost.
I noticed the share.hbs is:
When this share snippet is on particular pages, it works, but when I put it on the homepage, the twitter link turns into:
http://twitter.com/share?text=%5Bobject%20Object%5D&url=/
This tries to share
[object Object]
on Twitter.It's happening on my blog: http://matrix.ai/
Any ideas on how to fix it? The other share links FB and google+ works.