sanity-seo-checker-plugin

1.2.1 • Public • Published

Installation

  1. Run the following npm in your terminal:
npm install sanity-seo-checker-plugin

Configuration

  1. Go to your sanity.config.js file and add the following code:
import { defineConfig } from 'sanity'
import { seoTool } from 'sanity-plugin-seo-tool'
export default defineConfig({
// ...
plugins: [seoTool()],
// ...
})
  1. Go to your sanity.config.js file and add the following code:
schema: {
    types: schemaTypes.map(schemaType => {
      if (schemaType.name === 'post') {
        return {
          ...schemaType,
          fields: [
            ...schemaType.fields,
            {
              name: 'seoAnalysis',
              title: 'SEO Analysis',
              type: 'object',
              fields: [
                {
                  name: 'keyword',
                  type: 'string',
                  title: 'Keyword'
                },
                {
                  name: 'keywordCount',
                  type: 'number',
                  title: 'Keyword Count'
                },
                {
                  name: 'keywordInTitle',
                  type: 'boolean',
                  title: 'Keyword in Title'
                },
                {
                  name: 'keywordInH2',
                  type: 'boolean',
                  title: 'Keyword in H2'
                },
                {
                  name: 'wordCount',
                  type: 'number',
                  title: 'Word Count'
                },
                {
                  name: 'keywordPercentage',
                  type: 'number',
                  title: 'Keyword Percentage'
                }
              ],
              components: {
                input: SEOTool
              }
            }
          ]
        };
      }
      return schemaType;
    })
  },
  1. Go to src/config.example.js and rename it to config.js.
  2. Add your API key to the config.js file (get your API key at https://slashseo.com)
  3. Save all files and run the following npm:
npm run dev

Usage

  1. Go to your Sanity Studio and create a new post or edit an existing one.
  2. Go to your document and click on the SEO Analysis field (this will be displayed below the content Body field)
  3. The SEO analysis will be displayed in the SEO Analysis field.
  4. Click "Analyze SEO" to run the analysis or after making changes to your content to get the latest insights and score.

Readme

Keywords

Package Sidebar

Install

npm i sanity-seo-checker-plugin

Weekly Downloads

1

Version

1.2.1

License

MIT

Unpacked Size

15 kB

Total Files

5

Last publish

Collaborators

  • slashseo