@sveltia/cms 0.26.3 → 0.26.4
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 +18 -1
- package/dist/sveltia-cms.js +113 -105
- package/dist/sveltia-cms.mjs +118 -110
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -298,7 +298,11 @@ Alternatively, you can probably use one of the [Netlify/Decap CMS templates](htt
|
|
|
298
298
|
|
|
299
299
|
### Migration
|
|
300
300
|
|
|
301
|
-
Have a look at the [compatibility info](#compatibility) above first. If you’re already using Netlify/Decap CMS with the GitHub or GitLab backend and don’t have any custom widget, custom preview or plugin, migrating to Sveltia CMS is super easy — it works as a drop-in replacement. Edit `/admin/index.html` to replace the CMS `<script>` tag, and push the change to your repository.
|
|
301
|
+
Have a look at the [compatibility info](#compatibility) above first. If you’re already using Netlify/Decap CMS with the GitHub or GitLab backend and don’t have any custom widget, custom preview or plugin, migrating to Sveltia CMS is super easy — it works as a drop-in replacement. Edit `/admin/index.html` to replace the CMS `<script>` tag, and push the change to your repository. Your new `<script>` tag is:
|
|
302
|
+
|
|
303
|
+
```html
|
|
304
|
+
<script src="https://unpkg.com/@sveltia/cms/dist/sveltia-cms.js"></script>
|
|
305
|
+
```
|
|
302
306
|
|
|
303
307
|
From Netlify CMS:
|
|
304
308
|
|
|
@@ -318,6 +322,8 @@ That’s it! You can open `https://[hostname]/admin/` as before to start editing
|
|
|
318
322
|
|
|
319
323
|
That said, we strongly recommend testing your new Sveltia CMS instance first on your local machine. [See below](#working-with-a-local-git-repository) for how.
|
|
320
324
|
|
|
325
|
+
### Installing with npm
|
|
326
|
+
|
|
321
327
|
For advanced users, we have also made the bundle available as an [npm package](https://www.npmjs.com/package/@sveltia/cms). You can install it by running `npm i @sveltia/cms` or `pnpm add @sveltia/cms` on your project. The [manual initialization](https://decapcms.org/docs/manual-initialization/) flow with the `init` method is the same as for Netlify/Decap CMS.
|
|
322
328
|
|
|
323
329
|
### Updates
|
|
@@ -328,6 +334,17 @@ If you’ve chosen to install with npm, updating the package is your responsibil
|
|
|
328
334
|
|
|
329
335
|
## Tips & tricks
|
|
330
336
|
|
|
337
|
+
### Working around configuration loading issue
|
|
338
|
+
|
|
339
|
+
Depending on your server or framework’s configuration, when you access the CMS at `/admin/`, you’ll be redirected to `/admin` with the trailing slash removed. The CMS assumes that your configuration exists in the same directory, which means `/config.yml` is loaded instead of `/admin/config.yml`, resulting in an error saying “The configuration file could not be retrieved.” There are a couple of ways to work around this problem:
|
|
340
|
+
|
|
341
|
+
- Access `/admin/index.html` or `/admin/#/`
|
|
342
|
+
- Rename `/admin/index.html` to `/admin/cms.html`, and access `/admin/cms`
|
|
343
|
+
- [Specify the configuration file path](https://decapcms.org/docs/configuration-options/#configuration-file) with a `<link>` tag in the `/admin/index.html`:
|
|
344
|
+
```html
|
|
345
|
+
<link href="/admin/config.yml" type="text/yaml" rel="cms-config-url" />
|
|
346
|
+
```
|
|
347
|
+
|
|
331
348
|
### Providing a JSON configuration file
|
|
332
349
|
|
|
333
350
|
Sveltia CMS supports a configuration file written in the JSON format in addition to the standard YAML format. This allows developers to programmatically generate the CMS configuration to enable bulk or complex collections. To do this, simply add a `<link>` tag to your HTML, just like a [custom YAML config link](https://decapcms.org/docs/configuration-options/#configuration-file), but with the type `application/json`:
|