|
| 1 | +import Link from 'next/link'; |
| 2 | +import Alert from '@/components/Alert'; |
| 3 | +import { Paperclip, Wrench } from '@phosphor-icons/react/dist/ssr' |
| 4 | + |
| 5 | + |
1 | 6 | # Content Management System |
2 | 7 |
|
3 | | -The Content Management System, or CMS, is a powerful component that allows you to add custom static and dynamic pages to your website. |
| 8 | +The Content Management System, or CMS, is a powerful component that allows you to add custom pages and content to your website. |
| 9 | + |
| 10 | +CMS consists of 3 sub-components. Pages, snippets and resources. |
| 11 | + |
| 12 | +## Pages |
| 13 | + |
| 14 | +Pages |
| 15 | + |
| 16 | +## Snippets |
| 17 | + |
| 18 | + |
| 19 | +## Resources |
| 20 | + |
| 21 | +While you could link to any resource, or upload your own assets to your website, the resource system makes it easy for your site admins |
| 22 | +to find and replace static assets. |
| 23 | + |
| 24 | +Resources could be anything, images, downloads,... |
| 25 | + |
| 26 | +### Managing resources |
| 27 | + |
| 28 | +Resources can be uploaded from the admin panel, they can be found under <Wrench /> Settings -> <Paperclip /> Resources. |
| 29 | + |
| 30 | +Simply supply a name and the file and press save. After saving your resource, it will be given a slug. |
| 31 | +Take note of it, **this is what you will need to use the resource** in pages and snippets. |
| 32 | + |
| 33 | +### Using resources |
| 34 | + |
| 35 | +Resources can be used in pages and snippets using the `resource('resource-slug')` twig function |
| 36 | + |
| 37 | +<Alert severityy="info"> |
| 38 | + Currently it is only possible to use resources in Twig/Html pages and snippets. Rich text editor does not support them. |
| 39 | +</Alert> |
| 40 | + |
| 41 | +### Examples |
| 42 | + |
| 43 | +For the following examples, we've created a resource named "My Cool Resource". The slug that was generated for it is "my-cool-resource". |
| 44 | + |
| 45 | +#### Displaying an image |
| 46 | + |
| 47 | +To display a resource as an image, use the `<img>` tag, with the resource in the `src` attribute. |
| 48 | + |
| 49 | +```twig |
| 50 | +<img src="{{ resource('my-cool-resource') }}"> |
| 51 | +``` |
| 52 | + |
| 53 | +#### Dowloading a file |
| 54 | + |
| 55 | +To make the client download a resource, you can use an `<a>` tag, with the resource in the `href` attribute and setting the `download` attribute. |
| 56 | + |
| 57 | +This example shows a download button. |
4 | 58 |
|
| 59 | +```twig |
| 60 | +<a class="btn-primary" href="{{ resource('my-cool-resource') }}" download> |
| 61 | + <i class="ph ph-download-simple"></i> |
| 62 | + Download |
| 63 | +</a> |
| 64 | +``` |
5 | 65 |
|
0 commit comments