All Projects → syntra → Gatsby Remark Social Cards

syntra / Gatsby Remark Social Cards

Licence: mit
Gatsby remark plugin for generating social card graphics

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gatsby Remark Social Cards

Jekyll Seo Tag
A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content.
Stars: ✭ 1,226 (+1190.53%)
Mutual labels:  seo, social-media
Curatedseotools
Best SEO Tools Stash
Stars: ✭ 128 (+34.74%)
Mutual labels:  seo, social-media
Gatsby Plugin Advanced Sitemap
Advanced XML Sitemaps for Gatsby.js
Stars: ✭ 94 (-1.05%)
Mutual labels:  gatsby, seo
awesome-search-engine-optimization
A curated list of backlink, social signal opportunities, and link building strategies and tactics to help improve search engine results and ranking.
Stars: ✭ 82 (-13.68%)
Mutual labels:  social-media, seo
Advertools
advertools - online marketing productivity and analysis tools
Stars: ✭ 341 (+258.95%)
Mutual labels:  seo, social-media
meta-tag-gen
Generate HTML code optimal for social media, SEO, mobile. Uses web standards from Open Graph (Facebook) and Twitter to provide optimal results. Also generates social media posts.
Stars: ✭ 24 (-74.74%)
Mutual labels:  social-media, seo
Gatsby V2 Tutorial Starter
Gatsby V2 Starter - product of step by step tutorial
Stars: ✭ 139 (+46.32%)
Mutual labels:  gatsby, seo
Gatsby Starter Tyra
Tyra - Feminine Gatsby Starter optimized for SEO
Stars: ✭ 74 (-22.11%)
Mutual labels:  gatsby, seo
Gatsby Advanced Starter
A high performance skeleton starter for GatsbyJS that focuses on SEO/Social features/development environment.
Stars: ✭ 1,224 (+1188.42%)
Mutual labels:  gatsby, seo
Fluttersocialappuikit
Flutter representation of a Social App Concept.
Stars: ✭ 1,270 (+1236.84%)
Mutual labels:  social-media
Builder
Drag and drop page building using your code components
Stars: ✭ 1,281 (+1248.42%)
Mutual labels:  gatsby
Preact Redux Isomorphic
preact-redux-isomorphic PWA SPA SSR best practices and libraries in under 80kB page size (for live demo click the link below)
Stars: ✭ 85 (-10.53%)
Mutual labels:  seo
Somajo
A tokenizer and sentence splitter for German and English web and social media texts.
Stars: ✭ 85 (-10.53%)
Mutual labels:  social-media
Gatsby Remark Design System
🎨 Create your design system with Gatsby in Markdown
Stars: ✭ 90 (-5.26%)
Mutual labels:  gatsby
Gatsby Styled Blog Starter
My first GatsbyJS starter.
Stars: ✭ 86 (-9.47%)
Mutual labels:  gatsby
Gatsby Plugin Google Fonts
Bring Google Fonts to Gatsby https://www.gatsbyjs.org/
Stars: ✭ 84 (-11.58%)
Mutual labels:  gatsby
Jekyll Seo Gem
💎 🔎 A gem version of @bhardin's SEO Jekyll tool
Stars: ✭ 84 (-11.58%)
Mutual labels:  seo
Friendica Addons
Addons for Friendica
Stars: ✭ 94 (-1.05%)
Mutual labels:  social-media
Setup
My own front end web development set up, covering everything from operating system to analytics.
Stars: ✭ 93 (-2.11%)
Mutual labels:  seo
Gatsby Starter Procyon
An opinionated Gatsby starter designed for trash-eating pandas.
Stars: ✭ 88 (-7.37%)
Mutual labels:  gatsby

Elevator Pitch

Do you wish your Gatsby blog posts could look like this when getting shared to Twitter?

custom twitter blog post card

With this plugin, they can!

gatsby-remark-social-cards iterates over your markdown files and automatically generates graphical representations of the frontmatter data! It's highly customizable and can help increase your click rates.

Features/Roadmap

Greenkeeper badge

  • [x] Generates Twitter Card
  • [ ] Generates Facebook Card
  • [x] Custom Background Colors
  • [ ] Custom Background Image
  • [ ] Custom Font Colors (currently supports white and black) See #1
  • [ ] Custom Font Family (currently only supports DejaVuSansCondensed)
  • [x] Custom Font Size
  • [x] Custom Font Style (normal, italic, and bold)
  • [x] Custom Font Positioning
  • [x] Custom Metadata Strings
  • [ ] Watermark/Logo Support
  • [ ] Stackable Text Effects (opacity, drop shadow, stroke, pattern overlay)
  • [ ] Stackable Background Shapes (rect, circle, polygon)
  • [ ] Automatic Injection of Required <meta/> Tags

Installation

Prerequisites

It's recommended that you use gatsby-plugin-react-helmet for managing the <head/> of your website. This plugin only generates the card images, it's your responsibility to add the <meta/> tags to the <head/> of your layout (step 4).

The URLs set in the <meta/> tags also needs to be absolute paths. So make sure that you have siteUrl set in your gatsby-config.js:

  siteMetadata: {
    title: "My blog title",
    siteUrl: "https://mydomain.com", // no trailing slash!
  }
  1. Install the plugin
yarn add gatsby-remark-social-cards
  1. Add to your gatsby-transformer-remark plugins in gatsby-config.js
  plugins: [
    // ...
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          `gatsby-remark-social-cards`,
          // ...
        ],
      },
    },
  ],
  1. Restart Gatsby

  2. Add the <meta/> tags in the head

Note: it's typically recommended to have your <Helmet/> section inside your main layout component.

Add a prop for pathname to your layout component and use that along with the siteUrl to get the absolute path to the twitter card.

const Layout = ({ pathname, children }) => (
  <StaticQuery
    query={graphql`
      query SiteTitleQuery {
        site {
          siteMetadata {
            title
            siteUrl
          }
        }
      }
    `}
    render={data => (
      <Helmet title={data.site.siteMetadata.title}>
        <meta name="twitter:card" content="summary_large_image" />
        <meta
          name="twitter:image"
          content={`${data.site.siteMetadata.siteUrl}${pathname}twitter-card.jpg`}
        />
      </Helmet>
      { /* ... */ }
    )}
  />
);

Then inside your blog post template, pass location.pathname to the layout.

Note: router's location object is passed to every page in Gatsby

export default ({ location }) => {
  return <Layout pathname={location.pathname}>{/* ... */}</Layout>;
};
  1. There are additional meta tags that can and should be used, although the ones I showed above are the only ones required to properly see the card image. For more information, see the official docs for large summary cards

Configuration

I built this plugin to be as flexible as possible, so at first the config may seem daunting. But keep in mind, none of these settings are required. You can add as few or as much configuration as you desire. All values shown below are default.

  plugins: [
    // ...
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-social-cards`,
            options: {
              title: {
                // This is the frontmatter field the title should come from
                field: "title",
                // Currently only supports DejaVuSansCondensed
                // More fonts coming soon!
                font: "DejaVuSansCondensed",
                color: "black", // black|white
                size: 48, // 16|24|32|48|64
                style: "bold", // normal|bold|italic
                x: null, // Will default to xMargin
                y: null, // Will default to yMargin
              },
              meta: {
                // The parts array is what generates the bottom text
                // Pass an array with strings and objects
                // The following array will generate:
                // "- Author Name » September 13"
                // The objects are used to pull data from your markdown's
                // frontmatter. { field: "author" } pulls the author set
                // in the frontmatter. { field: "category" } would pull
                // the category set. Any field can be used as parts
                // Note: Only pass the "format" property on date fields
                parts: [
                  "- ",
                  { field: "author" },
                  " » ",
                  { field: "date", format: "mmmm dS" },
                ],
                // Currently only supports DejaVuSansCondensed
                // More fonts coming soon!
                font: "DejaVuSansCondensed",
                color: "black", // black|white
                size: 24, // 16|24|32|48|64
                style: "normal", // normal|bold|italic
                x: null, // Will default to xMargin
                y: null, // Will default to cardHeight - yMargin - size
              },
              background: "#FFFFFF", // Background color for the card
              xMargin: 24, // Edge margin used when x value is not set
              yMargin: 24,// Edge margin used when y value is not set
            }
          }
          // ...
        ],
      },
    },
  ],

Contributing

This plugin is in it's early stages, so any and all help is warmly welcomed!

  • ⇄ Pull/Merge requests and ★ Stars are always welcome!
  • For bugs and feature requests, please create an issue.

Changelog

See CHANGELOG.md

License

This project is licensed under the MIT License - see the LICENCE.md file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].