google plus share and parameters in url

user1502291 picture user1502291 · Aug 8, 2012 · Viewed 39.6k times · Source

I use Google+ to share some links on my page and there is a problem when I try to share an URL containing parameters. Example:

http://google.com?n=somethink&link=p/1393007&i=images/icons/gplus-16.png

When you put this URL into the field at this page:

https://developers.google.com/+/plugins/share/

...and click on the share button, you can't see information about page like name, picture and description. But when you delete the dot before "png", then Google shows data about the page.

The same thing happens when you write the ' symbol anywhere in the URL. I can't find any information about this error in Google Help Pages. It works when I use an URL like this:

http://google.com?n='&link=p/1393007&i=images/icons/gplus-16.png 

...but it isn't very elegant solution.

How to write clean URLs?

Answer

Sid picture Sid · Sep 9, 2012

currently G+ share supports only two parameters: url, for the target url, and hl, for a language code.

https://plus.google.com/share?url=http://www.stackoverflow.com

Alternatively, you can add OpenGraph tags to the head of your page to specify the same fields like this: (haven't tested yet)

<meta property="og:title" content="..."/>
<meta property="og:image" content="..."/>
<meta property="og:description" content="..."/>