有人在Twitter上问我这个问题。
在分享我制作的网站链接时,如何让图片显示出来?
要分享图片,你需要使用Open Graph元标签,也叫OG标签。
请看这篇博文。如何为macOS设置GitHub凭证。在Chrome浏览器上,在页面上点击右键,按View Source 。或者在Safari浏览器上,从开发菜单中点击Show Page Source (必须在设置中激活开发菜单)。
你可以在HTML的<head> 部分找到这些标签。
<meta property="og:title" content="How to set GitHub credentials for macOS">
<meta property="og:description" content="Set up GitHub authentication so you can use it from VS Code or the command line">
<meta property="og:type" content="article">
<meta property="og:url" content="https://flaviocopes.com/setup-github-credentials-macos/">
<meta property="og:image" content="https://flaviocopes.com/img/avatar.png"/>
对图像来说,重要的部分是og:image 标签,但所有这些都有助于创造一种方式,使其他软件更容易很好地显示我们的网站。
当你做任何改变时,请查看Twitter卡片验证器网站并粘贴页面的URL。这将显示一个预览,并会给你一些提示,告诉你该如何修复。
