Inspired by discourse's link expansion I am rolling out expansions for one line links on the blog waylonwalker. I was able to find a gatsby plugin gatsby-remark-embedder that expands one line links for social cards for popular platforms like twitter and YouTube through a repose from Kyle Mathews to my tweet.

https://twitter.com/kylemathews/status/1329817928666005504

Use Cases

This covers a couple of use cases I have with very little effort.

  • Twitter
  • YouTube

install


npm i gatsby-remark-embedder gatsby-plugin-twitter

This was super quick and simple to setup, the only thing that was extra was to install the gatsby-plugin-twitter plugin as well as the gatsby-remark-embedder.

enable


// In your gatsby-config.js

module.exports = {
  // Find the 'plugins' array
  plugins: [
    `gatsby-plugin-twitter`,
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-embedder`,
            options: {
              customTransformers: [
                // Your custom transformers
              ],
              services: {
                // The service-specific options by the name of the service
              },
            },
          },

          // Other plugins here...
        ],
      },
    },
  ],
};

Thats it, now I can embed tweets and YouTube videos by just leaving the link on a single line.