Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown type: seo-tools. #63

Closed
schellenbergk opened this issue Aug 22, 2022 · 4 comments
Closed

Unknown type: seo-tools. #63

schellenbergk opened this issue Aug 22, 2022 · 4 comments

Comments

@schellenbergk
Copy link

Not sure what the issue is but I've followed installation instructions and I keep getting this error.

Do I need to manually register seo-tools schema type?

@LiamMartens
Copy link
Owner

Since V3 the installation has changed. This is reflected in the README

@schellenbergk
Copy link
Author

I did follow the README instructions, and I'm still getting the error when I visit Sanity admin.

  1. sanity install seo-tools
  2. Added the pane
  3. Unknown type: seo-tools

@hanshenrik
Copy link

I also got this error, because I first followed the old guide, and I therefore had added something like this to one of my documents:

{
  name: "seo",
  title: "SEO",
  type: "seo-tools",
  options: { ... }
}

By removing this, the Unknown type: seo-tools error went away ✌️

@johannesmutter
Copy link

johannesmutter commented Oct 3, 2022

The documentation on the plugin page still shows the old instructions (which leads to above error):
https://www.sanity.io/plugins/sanity-plugin-seo-tools

To resolve:
Add this to the parts array in sanity.json (root folder):

{
  // ...
  "parts": [
     // ...
    {
      "name": "part:@sanity/desk-tool/structure",
      "path": "./deskStructure.js"
    }
  ]
}

Then create a file called deskStructure.js in root folder with this content:

import React from 'react'
import S from '@sanity/desk-tool/structure-builder'
import { SeoToolsPane } from 'sanity-plugin-seo-tools'

export const getDefaultDocumentNode = () => {
  return S.document().views([
    S.view.form(),
    S.view.component(SeoToolsPane).options({
      fetch: true,
      resolveProductionUrl: (doc) => (
        new URL(`https://sanity.io/${doc?.slug?.current}`)
      ),
      select: (doc) => ({
        focus_keyword: doc.focus_keyword ?? '',
        seo_title: doc.seo_title ?? '',
        meta_description: doc.meta_description ?? '',
        focus_synonyms: doc.focus_synonyms ?? [],
      }),
    }).title('SEO')
  ])
}

export default S.defaults()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants