Is there anyway to add share links to blogger like Facebook, GooglePlus, etc.? I thought there would be some kind of custom link for users to "Blog this" or something but I can't find anything like that after a lot of Googling.
I would think it'd be something like this:
www.blogger.com/share?URL=x
Blogger has deprecated that feature i guess, but still accessable.
Here is how.
https://www.blogger.com/blog-this.g?u=http://blogname.blogspot.com/2014/03/watch-new-xmen-days-of-future-past.html&n=My%20Post%20Name&t=Hello%20This%20is%20my%20blg%20this%20page?
?u= for your blogpost URL.
n= for your blogpost Title.
t= for your blogpost content.
Now insert those Parameters automatically by using blogger data tags.
<a expr:href='"https://www.blogger.com/blog-this.g?u=" + data:post.url + "&n=" + data:post.title + "&t=" + data:blog.metaDescription'>BLOG THIS</a>
Related
I'm trying to encode vertical bars in Blogger titles in urls because when I push an html tweet button on a post, Twitter's pop-up window doesn't show anything to tweet. However, when I encode the vertical bar to %7C, everything works fine.
For example, MSNBC uses vertical bars to split up their titles on Youtube, and I automatically embed their videos on one of my blogs. See here:
President Donald Trump's Friday Tweet: 'Iran Is Playing With Fire' |
Morning Joe | MSNBC
https://us-gov.blogspot.com/2017/02/president-donald-trumps-friday-tweet.html
But if anyone tries to tweet the post, they get a blank screen with the url https://twitter.com/share?url=https://us-gov.blogspot.com/2017/02/president-donald-trumps-friday-tweet.html&text=President%20Donald%20Trump%27s%20Friday%20Tweet:%20%27Iran%20Is%20Playing%20With%20Fire%27%20|%20Morning%20Joe%20|%20MSNBC
But if I encode the vertical bars to %7C, the Twitter window works fine.
https://twitter.com/share?url=https://us-gov.blogspot.com/2017/02/president-donald-trumps-friday-tweet.html&text=President%20Donald%20Trump%27s%20Friday%20Tweet:%20%27Iran%20Is%20Playing%20With%20Fire%27%20%7C%20Morning%20Joe%20%7C%20MSNBC
I'm just wondering if there's an easy way to prevent this from happening in my blog template's html code. Or if there's a simple script to use.
Thanks.
Instead of using the current share URL which is of the form -
<a expr:href='"https://twitter.com/share?url=" + data:post.url + "&text=" + data:post.title' aria-label='' class='resp-sharing-button__link' rel='nofollow' target='_blank'>Twitter</a>
Use the native sharing URL generator provided by Blogger -
<a expr:href='"https://www.blogger.com/share-post.g?blogID=" + data:blog.blogId + "&postID=" + data:post.id + "&target=twitter"' aria-label='' class='resp-sharing-button__link' rel='nofollow' target='_blank'>Twitter</a>
This will generate the URL of the form -
https://www.blogger.com/share-post.g?blogID=BLOGID&postID=POSTID&target=twitter
This will then automatically redirect to Twitter sharing window with the Title and URL of the post auto-filled. The title of the post will be escaped. This sharing URL generator can also be used for generating sharing URLs for other social networks as well (aka facebook,pinterest,email,googleplus by replacing the target parameter)
The downside of this being that you can't add users to follow or add hashtags like you would normally be able to do when building the Twitter sharing URL.
I'm adding disqus commenting to some articles on our site and all URLs are SEO friendly.
This means that, if the title of the article changes so will the URL of that article, which will discard the previous disqus comments (linked to the previous version of the URL).
The solution would be to strip out the title of the article from the URL before passing it to Disqus.
So I need to turn "http://mydomain.com/article/123-myarticle/section/1-sectiontitle" into "http://mydomain.com/article/123/section/1"
What is the easiest way to do this?
Thanks!
PS: I'm very new to Rails (i'm taking over a developed project)
You don't need to extract anything from the URL.
All you need to give to Disqus is a unique id.
So you can add a method to your model, called disqus_id for instance:
def disqus_id
"name_of_your_model_#{id}"
end
and then, in the javascript:
disqus_identifier = "<%= #your_model.disqus_id %>";
I have a fairly long list of quick links (approx. 20) that I'm going to embed on my main page. Instead of adding the full url of each link to the each anchor, is there a way to add maybe the end of each link.
For instance, if the link to the url is
http://support.proboards.com/index.cgi?display&thread=423890
as you can see, my forum is a proboards forum if that helps anything here.
the location of each url is local,
Instead of adding the complete url, is there a way to use something like
<a href = "&thread=423890">
or maybe
<a href = "this.thread=423890"> ?
Not in pure HTML, the best you'll get is <a href="index.cgi?display&thread=423890">, which is what you should already be using. Of course I'm assuming support.proboards.com is your site here.
You could use JavaScript and call a function like openThread(423890) if you really wanted, but a)I wonder what you really gain from it, b)this won't work for people with JavaScript turned off (a la NoScript), and c)I wonder if Google would properly see all the links.
Presumably, these pages are all being generated by server-side script anyway, so you should only really be coding index.cgi?display&thread= once anyway...
If you're hard-set on doing something shorter, I'd suggest using URL rewriting. You can have a URL like .../display/thread/423890 and then use something shorter if you're already from a /display/thread/ page. But this requires the link to go to a page you have control over.
on mysite I have the ability to add comments. Sometimes users enter comments will links (href. ...)
I would like to have those links to be clickable/linkable (a href) when the comment is displayed to users.
how with Rails 3 can I take a comment, and look for links and then wrap those links in an a href tag that opens in a new window?
Thanks
The simplest way is to use the auto_link method built into rails.
Note: In Rails 3.1 auto_link has been moved into a separate gem.
idlefinger's suggestion of #auto_link is perfect. I know it's not the question you originally posed, but wanted to suggest: also check out #simple_format, which will nicely format your users' use of newlines into br and p tags.
I am looking for a Ruby script that takes a piece of text, and makes any links click-able that show up in it... Does anyone have something like this? For example, if I wrote a comment and said "Come check out my site at http://www.example.com", then the link would be click-able like an html tag.
Thanks,
Josh
Rails has a View helper called auto_link, e.g.:
<%= auto_link("Please visit my site: http://www.example.org/") %>
would produce:
Please visit my site: http://www.example.org/
Update: You can find more information about it here.