@sveltia/cms 0.87.3 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -29
- package/dist/sveltia-cms.js +193 -193
- package/dist/sveltia-cms.js.map +1 -1
- package/dist/sveltia-cms.mjs +190 -190
- package/dist/sveltia-cms.mjs.map +1 -1
- package/package.json +1 -1
- package/schema/sveltia-cms.json +1160 -580
- package/types/public.d.ts +117 -69
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ The free, open source alternative/successor to Netlify/Decap CMS is now in publi
|
|
|
78
78
|
- [Configuring multiple media libraries](#configuring-multiple-media-libraries)
|
|
79
79
|
- [Optimizing images for upload](#optimizing-images-for-upload)
|
|
80
80
|
- [Disabling stock assets](#disabling-stock-assets)
|
|
81
|
+
- [Editing site deployment configuration files](#editing-site-deployment-configuration-files)
|
|
81
82
|
- [Editing data files with a top-level list](#editing-data-files-with-a-top-level-list)
|
|
82
83
|
- [Changing the input type of a DateTime field](#changing-the-input-type-of-a-datetime-field)
|
|
83
84
|
- [Rendering soft line breaks as hard line breaks in Markdown](#rendering-soft-line-breaks-as-hard-line-breaks-in-markdown)
|
|
@@ -112,7 +113,7 @@ Due to its unfortunate abandonment in early 2022, Netlify CMS spawned 3 successo
|
|
|
112
113
|
- **Sveltia CMS**: not a fork but a **complete rewrite** or “total reboot”, started in November 2022, first appeared on GitHub in March 2023
|
|
113
114
|
- [Decap CMS](https://github.com/decaporg/decap-cms): a rebranded version, [announced in February 2023](https://www.netlify.com/blog/netlify-cms-to-become-decap-cms/) as the official successor with a Netlify agency partner taking ownership — mostly stagnant, with only occasional releases
|
|
114
115
|
|
|
115
|
-
Sveltia CMS is the only project that doesn’t inherit the complexity, technical debt, and numerous bugs of Netlify CMS, which was launched in 2015. Our product is better by design: We rebuilt the app from the ground up using a [modern framework](https://svelte.dev/)
|
|
116
|
+
Sveltia CMS is the only project that doesn’t inherit the complexity, technical debt, and numerous bugs of Netlify CMS, which was launched in 2015. Our product is better by design: We have rebuilt the app from the ground up using a [modern framework](https://svelte.dev/) while closely monitoring and analyzing the Netlify/Decap CMS issue tracker. We don’t use any of the predecessor’s code. This allows us to make [hundreds of improvements](#differentiators) without getting stuck in the old system.
|
|
116
117
|
|
|
117
118
|
While Sveltia CMS was created to replace legacy Netlify CMS instances, it can also be used as an alternative to other Netlify CMS successors. With its [solid i18n support](#better-i18n-support), we’re hoping our product will eventually be an appearing option for anyone looking for a free headless CMS.
|
|
118
119
|
|
|
@@ -132,7 +133,7 @@ While we fix reported bugs as quickly as possible, usually within 24 hours, our
|
|
|
132
133
|
|
|
133
134
|
- Ensuring substantial [compatibility with Netlify/Decap CMS](#compatibility)
|
|
134
135
|
- Tackling as many [Netlify/Decap CMS issues](https://github.com/decaporg/decap-cms/issues) as possible
|
|
135
|
-
- So far, 230+ issues, or
|
|
136
|
+
- So far, 230+ issues, or 475+ if including duplicates, have been effectively solved in Sveltia CMS (Yes, you read it right)
|
|
136
137
|
- Target:
|
|
137
138
|
- 250 issues, or 500 if including duplicates, by GA — Almost there!
|
|
138
139
|
- 400 issues, or 800 if including duplicates, in the future 💪
|
|
@@ -227,15 +228,16 @@ Note: This lengthy section compares Sveltia CMS with both Netlify CMS and Decap
|
|
|
227
228
|
|
|
228
229
|
- Sveltia CMS is built with [Svelte](https://svelte.dev/), and we only publish compiled vanilla JavaScript bundles, so there are no React compatibility issues that might prevent developers from upgrading a project for many months.[^177] We haven’t actually integrated React for custom widgets and other features yet, but anyway, no dependencies will be installed when you [install the app with npm](#installing-with-npm).
|
|
229
230
|
- Sveltia CMS also won’t cause peer dependency conflicts mainly due to legacy third-party React UI libraries.[^175][^237] We build the app using [our own Svelte UI component library](https://github.com/sveltia/sveltia-ui) to reduce reliance on third parties.
|
|
230
|
-
- Some servers and frameworks are known to remove the trailing slash from the CMS URL (`/admin`) depending on the configuration. In such cases, the config file is loaded from
|
|
231
|
+
- Some servers and frameworks are known to remove the trailing slash from the CMS URL (`/admin`) depending on the configuration. In such cases, the config file is loaded from the proper URL (`/admin/config.yml`) instead of a regular relative URL (`./config.yml` = `/config.yml`), which results in a 404 Not Found error.[^107]
|
|
231
232
|
- The [robots `meta` tag](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag) is automatically added to HTML to prevent the admin page from being indexed by search engines.[^174] Developers are still encouraged to manually add `<meta name="robots" content="noindex">` to `index.html`, as not all crawlers support dynamically added tags. However, our solution should at least work with Google in case you forget to do so.
|
|
232
|
-
- Initializing the CMS twice (due to the incorrect or missing placement of `CMS_MANUAL_INIT`) will not result in a `NotFoundError`.[^251]
|
|
233
|
+
- Initializing the CMS twice (due to the incorrect or missing placement of `window.CMS_MANUAL_INIT`) will not result in a `NotFoundError`.[^251]
|
|
234
|
+
- Sveltia CMS automatically enables [manual initialization](https://decapcms.org/docs/manual-initialization/) when you import the JavaScript module, so you don’t need to have `window.CMS_MANUAL_INIT = true` in your code.
|
|
233
235
|
|
|
234
236
|
### Better configuration
|
|
235
237
|
|
|
236
238
|
- Sveltia CMS supports a [JSON configuration file](#providing-a-json-configuration-file) that can be generated for bulk or complex collections.[^60]
|
|
237
239
|
- Also supports [multiple configuration files](#providing-multiple-configuration-files) to allow developers to modularize the configuration.[^197]
|
|
238
|
-
- We provide an [up-to-date JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for YAML/JSON configuration files, which enables autocomplete and validation in
|
|
240
|
+
- We provide an [up-to-date JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for YAML/JSON configuration files, which enables autocomplete and validation in VS Code and other code editors.[^253]
|
|
239
241
|
- Improved TypeScript support: We keep our type definitions for `CMS.init()` and other methods complete, accurate, up-to-date and annotated.[^190][^191][^192][^193][^227] This makes it easier to provide a site config object when [manually initializing](https://decapcms.org/docs/manual-initialization/) the CMS.
|
|
240
242
|
|
|
241
243
|
### Better backend support
|
|
@@ -257,7 +259,7 @@ Note: This lengthy section compares Sveltia CMS with both Netlify CMS and Decap
|
|
|
257
259
|
|
|
258
260
|
### Better i18n support
|
|
259
261
|
|
|
260
|
-
Sveltia CMS has been built with a multilingual architecture from the very beginning. You can expect
|
|
262
|
+
Sveltia CMS has been built with a multilingual architecture from the very beginning. You can expect first-class internationalization (i18n) support, as it’s required by clients of maintainer [@kyoshino](https://github.com/kyoshino), who himself was a long-time Japanese localizer for [Mozilla](https://www.mozilla.org/) and currently lives in the [most diverse city in the world](https://en.wikipedia.org/wiki/Toronto) where 150+ languages are spoken.
|
|
261
263
|
|
|
262
264
|
- Configuration
|
|
263
265
|
- The [i18n limitations](https://decapcms.org/docs/i18n/#limitations) in Netlify/Decap CMS do not apply to Sveltia CMS:
|
|
@@ -279,8 +281,6 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
|
|
|
279
281
|
- Language labels appear in human-readable display names instead of ISO 639 language codes because it’s not easy for everyone to recognize `DE` as German, `NL` as Dutch, `ZH` as Chinese, and so on.
|
|
280
282
|
- Content editing
|
|
281
283
|
- [Integrates a translation service](#translating-entry-fields-with-one-click) to allow translation of text fields from another locale with one click.
|
|
282
|
-
- Earlier versions of Sveltia CMS included DeepL integration, but it’s disabled for now [due to an API limitation](https://github.com/sveltia/sveltia-cms/issues/437).
|
|
283
|
-
- More translation services will be added in the future.
|
|
284
284
|
- The Content Editor supports [RTL scripts](https://en.wikipedia.org/wiki/Right-to-left_script) such as Arabic, Hebrew and Persian.[^146]
|
|
285
285
|
- It’s possible to [disable non-default locale content](#disabling-non-default-locale-content).[^15]
|
|
286
286
|
- Boolean, DateTime, List and Number fields in the entry preview are displayed in a localized format.
|
|
@@ -321,6 +321,7 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
|
|
|
321
321
|
- The `date` transformation returns an empty string if an invalid date is given.[^176]
|
|
322
322
|
- Multiple transformations can be chained like `{{title | upper | truncate(20)}}`.
|
|
323
323
|
- Sveltia CMS supports [singletons](#using-singletons), a simple form of a file collection.[^233]
|
|
324
|
+
- A file collection supports files without extensions.[^255] This is useful for [editing site deployment configuration files](#editing-site-deployment-configuration-files), such as `_redirects` and `_headers`.
|
|
324
325
|
- The collection `label` defaults to the `name` value according to the [Decap CMS document](https://decapcms.org/docs/configuration-options/#collections), while Netlify/Decap CMS actually throws a configuration error if the `label` option is omitted.
|
|
325
326
|
- Nested fields (dot notation) can be used in the `path` option for a folder collection, e.g. `{{fields.state.name}}/{{slug}}`.[^62]
|
|
326
327
|
- Markdown is supported in the `description` collection option.[^79] Bold, italic, strikethrough, code and links are allowed.
|
|
@@ -373,6 +374,7 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
|
|
|
373
374
|
- The Preview Pane comes with a minimal default style.[^168] It looks nice without a custom preview style or template.
|
|
374
375
|
- For better performance, the Preview Pane doesn’t use an `<iframe>`.[^179]
|
|
375
376
|
- The Preview Pane displays all fields, including each label, making it easier to see which fields are populated.
|
|
377
|
+
- Field labels will not disappear when a long value is entered into the fields.[^254]
|
|
376
378
|
- Clicking a field in the Preview Pane focuses the corresponding field in the Edit Pane.[^41] It automatically expands when collapsed.
|
|
377
379
|
- This is equivalent to the (misleading) visual editing feature introduced in [Decap CMS 3.6.0](https://github.com/decaporg/decap-cms/releases/tag/decap-cms%403.6.0), but our click-to-highlight feature is enabled by default; you don’t need to opt in with the `editor.visualEditing` collection option.
|
|
378
380
|
- Our implementation doesn’t cause a module import error[^225] or broken image previews.[^188]
|
|
@@ -436,7 +438,7 @@ Sveltia CMS supports all [built-in widgets](https://decapcms.org/docs/widgets/)
|
|
|
436
438
|
- A collapsed List field will not display a programmatic summary like `List [ Map { "key": "value" } ]` if the `summary` option is not set.[^183]
|
|
437
439
|
- Map
|
|
438
440
|
- A search bar enables users to quickly locate a specific place on the map.[^252]
|
|
439
|
-
- With the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API), users can get their current location.
|
|
441
|
+
- With the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API), users can get their current location with one click.
|
|
440
442
|
- The value can be cleared if the field is optional.
|
|
441
443
|
- The map’s zoom level is adjusted more intuitively using pinch gestures.
|
|
442
444
|
- The map looks good in dark mode.
|
|
@@ -632,7 +634,7 @@ Sveltia CMS provides partial compatibility with [Static CMS](https://github.com/
|
|
|
632
634
|
- I18n support
|
|
633
635
|
- The `enforce_required_non_default` i18n option will not be supported. Sveitia CMS enforces required fields in all locales by default. However, the `save_all_locales` or `initial_locales` i18n option allows users to [disable non-default locales](#disabling-non-default-locale-content) if needed. Developers can also specify a subset of locales with the `required` field option, e.g. `required: [en]`.
|
|
634
636
|
- Widgets
|
|
635
|
-
- The date/time format options for the DateTime widget are
|
|
637
|
+
- The date/time format options for the DateTime widget are **not compatible** since Static CMS [switched to date-fns](https://staticjscms.netlify.app/docs/decap-migration-guide#dates) while Sveltia CMS continues to use Moment.js (and will soon switch to Day.js). Update your formats accordingly.
|
|
636
638
|
- The KeyValue widget is implemented in Sveltia CMS with the same options.
|
|
637
639
|
- The UUID widget is also implemented, but with different options.
|
|
638
640
|
- The `prefix` and `suffix` options for the Boolean, Number and String widgets are implemented as `before_input` and `after_input` in Sveltia CMS, respectively. Our `prefix` and `suffix` options for the String widget are literally a prefix and suffix to the value.
|
|
@@ -664,6 +666,7 @@ Sveitia CMS works with all modern browsers, but there are a few limitations beca
|
|
|
664
666
|
### Other notes
|
|
665
667
|
|
|
666
668
|
- Sveltia CMS requires a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts), meaning it only works with HTTPS, `localhost` or `127.0.0.1` URLs. If you’re running a remote server yourself and the content is served over HTTP, get a TLS certificate from [Let’s Encrypt](https://letsencrypt.org/).
|
|
669
|
+
- Some options added during the beta period may be changed or removed when the product reaches GA. While we’ll try to minimize breaking changes, please be aware that some of your configuration may need to be updated.
|
|
667
670
|
|
|
668
671
|
## Getting started
|
|
669
672
|
|
|
@@ -716,7 +719,7 @@ You can now open `https://[hostname]/admin/` as usual to start editing. There is
|
|
|
716
719
|
|
|
717
720
|
#### Editing the configuration file
|
|
718
721
|
|
|
719
|
-
For a better DX, we recommend [setting up the JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for the site configuration file in your code editor. If you have the YAML extension installed, VS Code may automatically apply the Netlify
|
|
722
|
+
For a better DX, we recommend [setting up the JSON schema](#enabling-autocomplete-and-validation-for-the-configuration-file) for the site configuration file in your code editor. If you have the YAML extension installed, VS Code may automatically apply the outdated Netlify CMS config schema to `config.yml`. To use the latest Sveltia CMS config schema instead, you need to specify its URL.
|
|
720
723
|
|
|
721
724
|
#### Migrating from Git Gateway backend
|
|
722
725
|
|
|
@@ -740,7 +743,7 @@ For advanced users, we have also made the bundle available as an [npm package](h
|
|
|
740
743
|
|
|
741
744
|
Updating Sveltia CMS is transparent, unless you include a specific version in the `<script>` source URL or use the npm package. Whenever you (re)load the CMS, the latest version will be served via [UNPKG](https://unpkg.com/). The CMS also periodically checks for updates and notifies you when a new version is available. After the product reaches GA, you could use a semantic version range (`^1.0.0`) like Netlify/Decap CMS.
|
|
742
745
|
|
|
743
|
-
If you’ve chosen to install with npm, updating the package is your responsibility. We recommend using [`ncu`](https://www.npmjs.com/package/npm-check-updates) or a service like [Dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/) to keep dependencies up to date,
|
|
746
|
+
If you’ve chosen to install with npm, updating the package is your responsibility. We strongly recommend using [`ncu`](https://www.npmjs.com/package/npm-check-updates) or a service like [Dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/) to keep dependencies up to date. Otherwise, you’ll miss important bug fixes and new features. (ProTip: We update our dependencies using `ncu -u && pnpm up`.)
|
|
744
747
|
|
|
745
748
|
## Tips & tricks
|
|
746
749
|
|
|
@@ -750,7 +753,7 @@ You can host your Sveltia CMS-managed site anywhere, such as [Cloudflare Pages](
|
|
|
750
753
|
|
|
751
754
|
### Enabling autocomplete and validation for the configuration file
|
|
752
755
|
|
|
753
|
-
Sveltia CMS provides a [JSON schema](https://json-schema.org/) for the configuration file, so you can get autocomplete and validation in your favourite code editor while editing the site configuration. The schema is generated from the source and always up to date with the latest CMS version.
|
|
756
|
+
Sveltia CMS provides a full [JSON schema](https://json-schema.org/) for the configuration file, so you can get autocomplete and validation in your favourite code editor while editing the site configuration. The schema is generated from the source and always up to date with the latest CMS version.
|
|
754
757
|
|
|
755
758
|
If you use VS Code, you can enable it for the YAML configuration file by installing the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) and adding the following to your project’s [VS Code settings file](https://code.visualstudio.com/docs/configure/settings#_settings-json-file) at `.vscode/settings.json`:
|
|
756
759
|
|
|
@@ -961,41 +964,47 @@ Note that the special index file is placed right under the `folder`, regardless
|
|
|
961
964
|
|
|
962
965
|
### Using singletons
|
|
963
966
|
|
|
964
|
-
The singleton collection is an unnamed, non-nested variant of a [file collection](https://decapcms.org/docs/collection-file/) that can be used to manage
|
|
967
|
+
The singleton collection is an unnamed, non-nested variant of a [file collection](https://decapcms.org/docs/collection-file/) that can be used to manage a set of pre-defined data files. Singleton files appear in the content library’s sidebar under the Files group, and users can open the Content Editor directly without navigating to a file list.
|
|
965
968
|
|
|
966
|
-
To create this special file collection, add the new `singletons` option, along with an array of file definitions, to the root level of your site configuration
|
|
969
|
+
To create this special file collection, add the new `singletons` option, along with an array of file definitions, to the root level of your site configuration.
|
|
970
|
+
|
|
971
|
+
This is a conventional file collection:
|
|
967
972
|
|
|
968
973
|
```yaml
|
|
969
974
|
collections:
|
|
970
|
-
# A conventional file collection
|
|
971
975
|
- name: data
|
|
972
976
|
label: Data
|
|
973
977
|
files:
|
|
974
978
|
- name: home
|
|
975
979
|
label: Home Page
|
|
976
980
|
file: content/home.yaml
|
|
977
|
-
|
|
981
|
+
icon: home
|
|
982
|
+
fields: ...
|
|
978
983
|
- name: settings
|
|
979
984
|
label: Site Settings
|
|
980
985
|
file: content/settings.yaml
|
|
981
|
-
|
|
986
|
+
icon: settings
|
|
987
|
+
fields: ...
|
|
988
|
+
```
|
|
982
989
|
|
|
983
|
-
|
|
990
|
+
It can be converted to the singleton collection like this:
|
|
991
|
+
|
|
992
|
+
```yaml
|
|
984
993
|
singletons:
|
|
985
994
|
- name: home
|
|
986
995
|
label: Home Page
|
|
987
996
|
file: content/home.yaml
|
|
988
|
-
icon: home
|
|
989
|
-
...
|
|
990
|
-
- divider: true # You can
|
|
997
|
+
icon: home
|
|
998
|
+
fields: ...
|
|
999
|
+
- divider: true # You can add dividers
|
|
991
1000
|
- name: settings
|
|
992
1001
|
label: Site Settings
|
|
993
1002
|
file: content/settings.yaml
|
|
994
1003
|
icon: settings
|
|
995
|
-
...
|
|
1004
|
+
fields: ...
|
|
996
1005
|
```
|
|
997
1006
|
|
|
998
|
-
If you want to reference a singleton file with a Relation field, use `_singletons` as the `collection` name.
|
|
1007
|
+
If you want to reference a singleton file with a Relation field, use `_singletons` (note an underscore prefix) as the `collection` name.
|
|
999
1008
|
|
|
1000
1009
|
### Using keyboard shortcuts
|
|
1001
1010
|
|
|
@@ -1023,6 +1032,8 @@ Sveltia CMS comes with a handy Google Cloud Translation API integration so that
|
|
|
1023
1032
|
|
|
1024
1033
|
Note that the Translation button on the pane header only translates empty fields, while in-field Translation buttons override any filled text.
|
|
1025
1034
|
|
|
1035
|
+
Earlier versions of Sveltia CMS included DeepL integration, but it has been disabled [due to an API limitation](https://github.com/sveltia/sveltia-cms/issues/437). More translation services will be added in the future.
|
|
1036
|
+
|
|
1026
1037
|
### Localizing entry slugs
|
|
1027
1038
|
|
|
1028
1039
|
In Sveltia CMS, it’s possible to localize entry slugs (filenames) if the i18n structure is `multiple_files` or `multiple_folders`. All you need is the `localize` filter for `slug` template tags:
|
|
@@ -1183,7 +1194,7 @@ In case you’re not aware, [WebP](https://developers.google.com/speed/webp) off
|
|
|
1183
1194
|
- The `width` and `height` options are the maximum width and height, respectively. If an image is larger than the specified dimension, it will be scaled down. Smaller images will not be resized.
|
|
1184
1195
|
- File processing is a bit slow on Safari because [native WebP encoding](https://caniuse.com/mdn-api_htmlcanvaselement_toblob_type_parameter_webp) is [not supported](https://bugs.webkit.org/show_bug.cgi?id=183257) and the [jSquash](https://github.com/jamsinclair/jSquash) library is used instead.
|
|
1185
1196
|
- AVIF conversion is not supported because no browser has native AVIF encoding support ([Chromium won’t fix it](https://issues.chromium.org/issues/40848792)) and the third-party library (and AVIF encoding in general) is very slow.
|
|
1186
|
-
- This feature is not intended for creating image variants in different formats and sizes. It should be done with a framework during the build process.
|
|
1197
|
+
- This feature is not intended for creating image variants in different formats and sizes. It should be done with a framework during the build process. Popular frameworks like [Astro](https://docs.astro.build/en/guides/images/), [Eleventy](https://www.11ty.dev/docs/plugins/image/), [Hugo](https://gohugo.io/content-management/image-processing/), [Next.js](https://nextjs.org/docs/pages/api-reference/components/image) and [SvelteKit](https://svelte.dev/docs/kit/images) have built-in image processing capabilities.
|
|
1187
1198
|
- We may add more transformation options in the future.
|
|
1188
1199
|
|
|
1189
1200
|
### Disabling stock assets
|
|
@@ -1196,6 +1207,37 @@ media_libraries:
|
|
|
1196
1207
|
providers: []
|
|
1197
1208
|
```
|
|
1198
1209
|
|
|
1210
|
+
### Editing site deployment configuration files
|
|
1211
|
+
|
|
1212
|
+
Sveltia CMS allows users to edit files without extensions. Examples include `_headers` and `_redirects`, which are used by some static site hosting providers, such as [Netlify](https://docs.netlify.com/routing/redirects/), [GitLab Pages](https://docs.gitlab.com/user/project/pages/redirects/) and [Cloudflare Pages](https://developers.cloudflare.com/pages/configuration/redirects/). Since the `body` field is saved without a field name when using the default `yaml-frontmatter` format, you can use the following configuration to edit these files in the Content Editor:
|
|
1213
|
+
|
|
1214
|
+
```yaml
|
|
1215
|
+
collections:
|
|
1216
|
+
- name: config
|
|
1217
|
+
label: Site Configuration
|
|
1218
|
+
editor:
|
|
1219
|
+
preview: false
|
|
1220
|
+
files:
|
|
1221
|
+
- name: headers
|
|
1222
|
+
label: Headers
|
|
1223
|
+
file: static/_headers # The path varies by framework
|
|
1224
|
+
fields:
|
|
1225
|
+
- name: body
|
|
1226
|
+
label: Headers
|
|
1227
|
+
widget: code
|
|
1228
|
+
output_code_only: true
|
|
1229
|
+
allow_language_selection: false
|
|
1230
|
+
- name: redirects
|
|
1231
|
+
label: Redirects
|
|
1232
|
+
file: static/_redirects # The path varies by framework
|
|
1233
|
+
fields:
|
|
1234
|
+
- name: body
|
|
1235
|
+
label: Redirects
|
|
1236
|
+
widget: code
|
|
1237
|
+
output_code_only: true
|
|
1238
|
+
allow_language_selection: false
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1199
1241
|
### Editing data files with a top-level list
|
|
1200
1242
|
|
|
1201
1243
|
Sveltia CMS allows you to edit and save a list at the top-level of a data file, without a field name. All you need to do is create a single List field with the new `root` option set to `true`. The configuration below reproduces [this Jekyll data file example](https://jekyllrb.com/docs/datafiles/#example-list-of-members):
|
|
@@ -1208,6 +1250,7 @@ collections:
|
|
|
1208
1250
|
- name: members
|
|
1209
1251
|
label: Member List
|
|
1210
1252
|
file: _data/members.yml
|
|
1253
|
+
icon: group
|
|
1211
1254
|
fields:
|
|
1212
1255
|
- name: members
|
|
1213
1256
|
label: Members
|
|
@@ -1221,13 +1264,34 @@ collections:
|
|
|
1221
1264
|
label: GitHub account
|
|
1222
1265
|
```
|
|
1223
1266
|
|
|
1224
|
-
|
|
1267
|
+
It also works with a [singleton](#using-singletons):
|
|
1268
|
+
|
|
1269
|
+
```yaml
|
|
1270
|
+
singletons:
|
|
1271
|
+
- name: members
|
|
1272
|
+
label: Member List
|
|
1273
|
+
file: _data/members.yml
|
|
1274
|
+
icon: group
|
|
1275
|
+
fields:
|
|
1276
|
+
- name: members
|
|
1277
|
+
label: Members
|
|
1278
|
+
label_singular: Member
|
|
1279
|
+
widget: list
|
|
1280
|
+
root: true # This does the trick
|
|
1281
|
+
fields:
|
|
1282
|
+
- name: name
|
|
1283
|
+
label: Name
|
|
1284
|
+
- name: github
|
|
1285
|
+
label: GitHub account
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
Note: The `root` option is ignored if the file or singleton contains multiple fields. You can still have subfields under the List field.
|
|
1225
1289
|
|
|
1226
1290
|
### Changing the input type of a DateTime field
|
|
1227
1291
|
|
|
1228
1292
|
It may be worth mentioning this topic here because the current [Decap CMS doc about the DateTime widget](https://decapcms.org/docs/widgets/#datetime) is unclear. By default, a DateTime field lets users pick both [date and time](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local), but developers can change the input type if needed.
|
|
1229
1293
|
|
|
1230
|
-
|
|
1294
|
+
Set `time_format` to `false` to hide the time picker and make the input [date only](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date):
|
|
1231
1295
|
|
|
1232
1296
|
```yaml
|
|
1233
1297
|
- label: Start Date
|
|
@@ -1236,7 +1300,7 @@ Use `time_format: false` to hide the time picker and make the input [date only](
|
|
|
1236
1300
|
time_format: false
|
|
1237
1301
|
```
|
|
1238
1302
|
|
|
1239
|
-
|
|
1303
|
+
Set `date_format` to `false` to hide the date picker and make the input [time only](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time):
|
|
1240
1304
|
|
|
1241
1305
|
```yaml
|
|
1242
1306
|
- label: Start Time
|
|
@@ -1245,7 +1309,7 @@ Use `date_format: false` to hide the date picker and make the input [time only](
|
|
|
1245
1309
|
date_format: false
|
|
1246
1310
|
```
|
|
1247
1311
|
|
|
1248
|
-
We understand that this configuration may be a bit confusing, but it’s necessary to maintain backward compatibility with Netlify CMS. We plan to
|
|
1312
|
+
We understand that this configuration may be a bit confusing, but it’s necessary to maintain backward compatibility with Netlify CMS. We plan to add the `type` option to the DateTime widget and introduce new input types: year, [month](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/month) and [week](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/week).
|
|
1249
1313
|
|
|
1250
1314
|
### Rendering soft line breaks as hard line breaks in Markdown
|
|
1251
1315
|
|
|
@@ -2023,3 +2087,7 @@ This software is provided “as is” without any express or implied warranty. W
|
|
|
2023
2087
|
[^252]: Netlify/Decap CMS [#6629](https://github.com/decaporg/decap-cms/issues/6629)
|
|
2024
2088
|
|
|
2025
2089
|
[^253]: Netlify/Decap CMS [#6635](https://github.com/decaporg/decap-cms/issues/6635), [#7006](https://github.com/decaporg/decap-cms/issues/7006), [#7311](https://github.com/decaporg/decap-cms/issues/7311)
|
|
2090
|
+
|
|
2091
|
+
[^254]: Netlify/Decap CMS [#7532](https://github.com/decaporg/decap-cms/issues/7532)
|
|
2092
|
+
|
|
2093
|
+
[^255]: Netlify/Decap CMS [#7355](https://github.com/decaporg/decap-cms/discussions/7355)
|