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

how do I use this as asset source? #4

Open
ajmalafif opened this issue May 10, 2021 · 1 comment
Open

how do I use this as asset source? #4

ajmalafif opened this issue May 10, 2021 · 1 comment

Comments

@ajmalafif
Copy link

ajmalafif commented May 10, 2021

I noticed the Cloudinary config in this plugin works way safer than the other one, however I am missing some links on how do I use this plugin as sanity asset source?

Any tips or pointers?

@ajmalafif
Copy link
Author

ajmalafif commented May 14, 2021

sanity studio

image

schema.js

// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'

// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'

// document schemas
import author from './documents/author'
import category from './documents/category'
import post from './documents/post'
import siteSettings from './documents/siteSettings'

// Object types
import bodyPortableText from './objects/bodyPortableText'
import bioPortableText from './objects/bioPortableText'
import excerptPortableText from './objects/excerptPortableText'
import mainImage from './objects/mainImage'
import authorReference from './objects/authorReference'

// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
  // We name our schema
  name: 'blog',
  // Then proceed to concatenate our our document type
  // to the ones provided by any plugins that are installed
  types: schemaTypes.concat([
    // The following are document types which will appear
    // in the studio.
    siteSettings,
    post,
    category,
    author,
    mainImage,
    authorReference,
    bodyPortableText,
    bioPortableText,
    excerptPortableText

    // When added to this list, object types can be used as
    // { type: 'typename' } in other document schemas
  ])
})

sanity.json

{
  "root": true,
  "project": {
    "name": "afif.dev"
  },
  "api": {
    "projectId": "#######",
    "dataset": "#######"
  },
  "plugins": [
    "@sanity/base",
    "@sanity/components",
    "@sanity/default-layout",
    "@sanity/default-login",
    "@sanity/dashboard",
    "@sanity/desk-tool",
    "dashboard-widget-structure-menu",
    "dashboard-widget-document-list",
    "dashboard-widget-netlify",
    "graph-view",
    "media",
    "asset-source-unsplash",
    "@sanity/code-input"
  ],
  "parts": [
    {
      "name": "part:@sanity/base/schema",
      "path": "./schemas/schema.js"
    },
    {
      "implements": "part:@sanity/base/theme/variables/override-style",
      "path": "./src/styles/variables.css"
    },
    {
      "name": "part:@sanity/desk-tool/structure",
      "path": "./src/structure/deskStructure.js"
    },
    {
      "implements": "part:@sanity/dashboard/config",
      "path": "./src/dashboardConfig.js"
    }
  ]
}

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

1 participant