Skip to content

Commit f6d804a

Browse files
committed
Set up Sanity
1 parent 7df3646 commit f6d804a

19 files changed

+10302
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4-
/node_modules
4+
node_modules
55
/.pnp
66
.pnp.js
77

studio/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Sanity Blogging Content Studio
2+
3+
Congratulations, you have now installed the Sanity Content Studio, an open source real-time content editing environment connected to the Sanity backend.
4+
5+
Now you can do the following things:
6+
7+
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
8+
- Check out the example frontend: [React/Next.js](https://github.com/sanity-io/tutorial-sanity-blog-react-next)
9+
- [Read the blog post about this template](https://www.sanity.io/blog/build-your-own-blog-with-sanity-and-next-js?utm_source=readme)
10+
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
11+
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)

studio/config/.checksums

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"#": "Used by Sanity to keep track of configuration file checksums, do not delete or modify!",
3+
"@sanity/default-layout": "bb034f391ba508a6ca8cd971967cbedeb131c4d19b17b28a0895f32db5d568ea",
4+
"@sanity/default-login": "6fb6d3800aa71346e1b84d95bbcaa287879456f2922372bb0294e30b968cd37f",
5+
"@sanity/form-builder": "b38478227ba5e22c91981da4b53436df22e48ff25238a55a973ed620be5068aa",
6+
"@sanity/data-aspects": "d199e2c199b3e26cd28b68dc84d7fc01c9186bf5089580f2e2446994d36b3cb6"
7+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"listOptions": {}
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"toolSwitcher": {
3+
"order": [],
4+
"hidden": []
5+
}
6+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"providers": {
3+
"mode": "append",
4+
"redirectOnSingle": false,
5+
"entries": []
6+
}
7+
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"images": {
3+
"directUploads": true
4+
}
5+
}

studio/package.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "nextjstektonblogbyem",
3+
"private": true,
4+
"version": "1.0.0",
5+
"description": "",
6+
"main": "package.json",
7+
"author": "Eugene Molari <[email protected]>",
8+
"license": "UNLICENSED",
9+
"scripts": {
10+
"start": "sanity start",
11+
"build": "sanity build"
12+
},
13+
"keywords": [
14+
"sanity"
15+
],
16+
"dependencies": {
17+
"@sanity/base": "^2.20.0",
18+
"@sanity/core": "^2.20.0",
19+
"@sanity/default-layout": "^2.20.0",
20+
"@sanity/default-login": "^2.19.0",
21+
"@sanity/desk-tool": "^2.20.0",
22+
"@sanity/vision": "^2.20.0",
23+
"prop-types": "^15.7",
24+
"react": "^17.0",
25+
"react-dom": "^17.0",
26+
"styled-components": "^5.2.0"
27+
},
28+
"devDependencies": {},
29+
"repository": {
30+
"type": "git",
31+
"url": "[email protected]:eugelogic/tekton.git"
32+
}
33+
}

studio/plugins/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
User-specific packages can be placed here

studio/sanity.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": true,
3+
"project": {
4+
"name": "NextJS Tekton Blog by EM"
5+
},
6+
"api": {
7+
"projectId": "7uj3lha9",
8+
"dataset": "production"
9+
},
10+
"plugins": [
11+
"@sanity/base",
12+
"@sanity/default-layout",
13+
"@sanity/default-login",
14+
"@sanity/desk-tool"
15+
],
16+
"env": {
17+
"development": {
18+
"plugins": [
19+
"@sanity/vision"
20+
]
21+
}
22+
},
23+
"parts": [
24+
{
25+
"name": "part:@sanity/base/schema",
26+
"path": "./schemas/schema"
27+
}
28+
]
29+
}

studio/schemas/author.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
export default {
2+
name: 'author',
3+
title: 'Author',
4+
type: 'document',
5+
fields: [
6+
{
7+
name: 'name',
8+
title: 'Name',
9+
type: 'string',
10+
},
11+
{
12+
name: 'slug',
13+
title: 'Slug',
14+
type: 'slug',
15+
options: {
16+
source: 'name',
17+
maxLength: 96,
18+
},
19+
},
20+
{
21+
name: 'image',
22+
title: 'Image',
23+
type: 'image',
24+
options: {
25+
hotspot: true,
26+
},
27+
},
28+
{
29+
name: 'bio',
30+
title: 'Bio',
31+
type: 'array',
32+
of: [
33+
{
34+
title: 'Block',
35+
type: 'block',
36+
styles: [{title: 'Normal', value: 'normal'}],
37+
lists: [],
38+
},
39+
],
40+
},
41+
],
42+
preview: {
43+
select: {
44+
title: 'name',
45+
media: 'image',
46+
},
47+
},
48+
}

studio/schemas/blockContent.js

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* This is the schema definition for the rich text fields used for
3+
* for this blog studio. When you import it in schemas.js it can be
4+
* reused in other parts of the studio with:
5+
* {
6+
* name: 'someName',
7+
* title: 'Some title',
8+
* type: 'blockContent'
9+
* }
10+
*/
11+
export default {
12+
title: 'Block Content',
13+
name: 'blockContent',
14+
type: 'array',
15+
of: [
16+
{
17+
title: 'Block',
18+
type: 'block',
19+
// Styles let you set what your user can mark up blocks with. These
20+
// correspond with HTML tags, but you can set any title or value
21+
// you want and decide how you want to deal with it where you want to
22+
// use your content.
23+
styles: [
24+
{title: 'Normal', value: 'normal'},
25+
{title: 'H1', value: 'h1'},
26+
{title: 'H2', value: 'h2'},
27+
{title: 'H3', value: 'h3'},
28+
{title: 'H4', value: 'h4'},
29+
{title: 'Quote', value: 'blockquote'},
30+
],
31+
lists: [{title: 'Bullet', value: 'bullet'}],
32+
// Marks let you mark up inline text in the block editor.
33+
marks: {
34+
// Decorators usually describe a single property – e.g. a typographic
35+
// preference or highlighting by editors.
36+
decorators: [
37+
{title: 'Strong', value: 'strong'},
38+
{title: 'Emphasis', value: 'em'},
39+
],
40+
// Annotations can be any object structure – e.g. a link or a footnote.
41+
annotations: [
42+
{
43+
title: 'URL',
44+
name: 'link',
45+
type: 'object',
46+
fields: [
47+
{
48+
title: 'URL',
49+
name: 'href',
50+
type: 'url',
51+
},
52+
],
53+
},
54+
],
55+
},
56+
},
57+
// You can add additional types here. Note that you can't use
58+
// primitive types such as 'string' and 'number' in the same array
59+
// as a block type.
60+
{
61+
type: 'image',
62+
options: {hotspot: true},
63+
},
64+
],
65+
}

studio/schemas/category.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export default {
2+
name: 'category',
3+
title: 'Category',
4+
type: 'document',
5+
fields: [
6+
{
7+
name: 'title',
8+
title: 'Title',
9+
type: 'string',
10+
},
11+
{
12+
name: 'description',
13+
title: 'Description',
14+
type: 'text',
15+
},
16+
],
17+
}

studio/schemas/post.js

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
export default {
2+
name: 'post',
3+
title: 'Post',
4+
type: 'document',
5+
fields: [
6+
{
7+
name: 'title',
8+
title: 'Title',
9+
type: 'string',
10+
},
11+
{
12+
name: 'slug',
13+
title: 'Slug',
14+
type: 'slug',
15+
options: {
16+
source: 'title',
17+
maxLength: 96,
18+
},
19+
},
20+
{
21+
name: 'author',
22+
title: 'Author',
23+
type: 'reference',
24+
to: {type: 'author'},
25+
},
26+
{
27+
name: 'mainImage',
28+
title: 'Main image',
29+
type: 'image',
30+
options: {
31+
hotspot: true,
32+
},
33+
},
34+
{
35+
name: 'categories',
36+
title: 'Categories',
37+
type: 'array',
38+
of: [{type: 'reference', to: {type: 'category'}}],
39+
},
40+
{
41+
name: 'publishedAt',
42+
title: 'Published at',
43+
type: 'datetime',
44+
},
45+
{
46+
name: 'body',
47+
title: 'Body',
48+
type: 'blockContent',
49+
},
50+
],
51+
52+
preview: {
53+
select: {
54+
title: 'title',
55+
author: 'author.name',
56+
media: 'mainImage',
57+
},
58+
prepare(selection) {
59+
const {author} = selection
60+
return Object.assign({}, selection, {
61+
subtitle: author && `by ${author}`,
62+
})
63+
},
64+
},
65+
}

studio/schemas/schema.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// First, we must import the schema creator
2+
import createSchema from 'part:@sanity/base/schema-creator'
3+
4+
// Then import schema types from any plugins that might expose them
5+
import schemaTypes from 'all:part:@sanity/base/schema-type'
6+
7+
// We import object and document schemas
8+
import blockContent from './blockContent'
9+
import category from './category'
10+
import post from './post'
11+
import author from './author'
12+
13+
// Then we give our schema to the builder and provide the result to Sanity
14+
export default createSchema({
15+
// We name our schema
16+
name: 'default',
17+
// Then proceed to concatenate our document type
18+
// to the ones provided by any plugins that are installed
19+
types: schemaTypes.concat([
20+
// The following are document types which will appear
21+
// in the studio.
22+
post,
23+
author,
24+
category,
25+
// When added to this list, object types can be used as
26+
// { type: 'typename' } in other document schemas
27+
blockContent,
28+
]),
29+
})

studio/static/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Files placed here will be served by the Sanity server under the `/static`-prefix

studio/static/favicon.ico

1.12 KB
Binary file not shown.

studio/tsconfig.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
// Note: This config is only used to help editors like VS Code understand/resolve
3+
// parts, the actual transpilation is done by babel. Any compiler configuration in
4+
// here will be ignored.
5+
"include": ["./node_modules/@sanity/base/types/**/*.ts", "./**/*.ts", "./**/*.tsx"]
6+
}

0 commit comments

Comments
 (0)