这个问题,我发现目前现网上的资料很少有全的,都是不对。分享要么没图标,要么显示不对。经过采坑,分享记录一下,完全的如下:
<a href="https://twitter.com/share?lang=zh&text=我的世界&url=https%3A%2F%2Ftest.koa.com%2Fregist%3Fid=99" class="share-twitter">Twitter</a>
<a href="https://www.facebook.com/share.php?title=我的世界&u=https%3A%2F%2Ftest.koa.com%2Fregist%3Fid=99" class="share-facebook">Facebook</a>
<a href="https://www.linkedin.com/shareArticle?mini=true&source=str&title=我的世界&url=https%3A%2F%2Fbeta.koa.com%2Fregist" class="share-linkedin">LinkedIn</a>
image.gif
图解:
image
image.gif
上面是分享按钮,设置好之后 在要 head 上加上 如下 :
<!-- twitter-->
<meta name="twitter:image" content="https://koa.com/logo_128x128.png" />
<meta name="twitter:creator" content="@veroluiza" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:url" content="当前分享的链接--可要可不要" />
<!-- facebook -->
<meta property="og:updated_time" content="2019-01-22T21:34:21+00:00" />
<meta property="og:image" content="https://koa.com/logo_128x128.png" />
<meta property="og:image:secure_url" content="https://koa.com/logo_128x128.png" />
<meta property="og:image:width" content="128" />
<meta property="og:image:height" content="128" />
image.gif
=========================================================================================
那么分享之后的,就会有 图标。 跟标题了。自动带链接过去!!图标必须是要url链接形式,直接写图标文件目录是不行的。
最后一个问题呢,就是领英的分享 带图标的话,图标抓取只认 二级域名, 一级域名不认,虽然不知道为啥,但这是多次实验的结果,欢迎指正!!