Skip to content

Commit 7aadd4f

Browse files
committed
add resource docs to cms
1 parent 8ea8ecd commit 7aadd4f

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

src/app/guides/customization/security/page.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Link from 'next/link';
12
import Alert from '@/components/Alert';
23

34
# Security

src/app/user-manual/cms/page.mdx

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
1+
import Link from 'next/link';
2+
import Alert from '@/components/Alert';
3+
import { Paperclip, Wrench } from '@phosphor-icons/react/dist/ssr'
4+
5+
16
# Content Management System
27

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.
458

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+
```
565

src/styles/index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ main {
106106
}
107107
}
108108

109-
.rich-text *:first-child {
109+
.rich-text > *:first-child {
110110
margin-top: 0;
111111
}
112112

@@ -134,6 +134,7 @@ ol, ul {
134134
display: flex;
135135
align-items: center;
136136
gap: var(--spacing-2);
137+
margin-top: var(--spacing-2);
137138

138139
svg {
139140
opacity: 0;

0 commit comments

Comments
 (0)