The Link Preview For This Page Is A QR Code That Links To This Page

TheOnlyEmployee

Rob Koch | @TheOnlyEmployee

April 10, 2021

Using our API, we set a meta tag in the head of our page:

<head>
  ...
  <meta 
    name="image" 
    property="og:image" 
    content="https://api.sw.ink/v0/swink?key={key}&url=https%3A%2F%2Fqr.new%2Fblog%2F2021-04-10-link-preview"
  >
  ...
</head>

We can use the same link for directly embedding images, and for a tags we can change the format query param to redirect:

<a href="https://api.sw.ink/v0/swink?key={key}&format=redirect&url=...">
  <img src="https://api.sw.ink/v0/swink?key={key}&url=...">
</a>

Who knew that link previews could actually be useful.

See it in action by broadly sharing the link to this page via twitter, slack, or text.