-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new documentation about templates
- Loading branch information
1 parent
2bddf2f
commit 47da9a7
Showing
4 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Remove default new document template | ||
|
||
This plugin creates new [Parameterized initial value templates](https://www.sanity.io/docs/initial-value-templates#66d873e2136f) so that any schema types configured in the plugin can be started with a language field already set. | ||
|
||
However, it does not remove the default new document template which would start a document with no language field value. So your "new document" menus might look like this: | ||
|
||
 | ||
|
||
To remove the default new document option, update your Sanity Studio configuration like below, where `prev` represents all previously registered templates in the Studio, and we filter out some defaults based on schema type and ID. | ||
|
||
```ts | ||
// ./sanity.config.ts | ||
|
||
export default defineConfig({ | ||
//...rest of config | ||
schema: { | ||
// ...rest of schema | ||
|
||
// Filter out the default template for new "page" and "lesson" type documents | ||
templates: (prev) => | ||
prev.filter((template) => !['page', 'lesson'].includes(template.id)), | ||
}, | ||
}) | ||
``` | ||
|
||
Now your new document menu for just this type will look like this | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.