Socket
Book a DemoInstallSign in
Socket

gatsby-plugin-seo

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-seo

## Install

0.0.2
latest
npmnpm
Version published
Weekly downloads
164
-9.39%
Maintainers
1
Weekly downloads
 
Created
Source

Gatsby Plugin SEO

Install

yarn add gatsby-plugin-seo
// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "gatsby-plugin-seo",
      options: {
        siteName: "Example Company",
        defaultSiteImage: "/img/logo.png",
        siteUrl: "https://example.com",
        twitterCreator: "@twitterhandle",
        twitterSite: "@twitterhandle",
        globalSchema: `{
            "@type": "WebSite",
            "@id": "https://example.com/#website",
            "url": "https://example.com/",
            "name": "Example Site Title",
            "publisher": {
              "@id": "https://example.com/about/#organization"
            },
            "image": {
              "@type": "ImageObject",
              "@id": "https://example.com/#logo",
              "url": "https://example.com/img/logo.png",
              "caption": "Example Company Logo"
            }
          }`
      }
    }
  ]
};
// src/pages/index.js
import React from "react";
import Layout from "../components/layout";
import { SEO, useSEO } from "gatsby-plugin-seo";

const IndexPage = () => {
  const { siteUrl } = useSEO();
  return (
    <Layout>
      <SEO
        title="Home"
        description="Description of the site/home page."
        pagePath="/"
        schema={`{
              "@context": "http://schema.org",
              "@type": "WebPage",
              "mainEntity": {
                "@type": "Organization",
                "name": "Example Company",
                "image": "${siteUrl}/img/logo.png"
              }
            }`}
      />
      <h1>Hi people</h1>
      <p>Welcome to your new Gatsby site.</p>
    </Layout>
  );
};

export default IndexPage;

Options

{
  siteName, // required
  siteUrl, // required
  defaultSiteImage, // if blank and each page doesn't supply an image, will throw runtime error if requireImage is set to true
  twitterCreator = "",
  twitterSite = "",
  globalSchema = "",
  requireImage = true,
  htmlLanguage = "en",
  locale = "en_US",
  defaultAuthorUrl = "",
  defaultPublisherUrl = "",
  appleTouch = "/img/apple-touch-icon.png",
  favicon32 = "/img/favicon-32x32.png",
  favicon16 = "/img/favicon-16x16.png",
}

Contribute

Bugs, ideas, issues, PRs welcome!

Keywords

gatsby

FAQs

Package last updated on 09 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.