You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,13 +24,15 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
24
24
25
25
- A Scaleway account logged into the [console](https://console.scaleway.com)
26
26
-[Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
27
-
- Installed Python
28
-
- Installed pip
29
-
- Installed Visual Studio Code
30
-
- Knowledge of the [Markdown](https://www.markdownguide.org/getting-started/#what-is-markdown) markup language
-[Installed Visual Studio Code](https://code.visualstudio.com/download)
30
+
- Knowledge of the [markdown](https://www.markdownguide.org/getting-started/#what-is-markdown) markup language
31
+
32
+
## Set up MkDocs and configure your website
33
+
34
+
### Setting up MkDocs
31
35
32
-
<Tabsid="install">
33
-
<TabsTablabel="Set up MkDocs and configure your website">
34
36
1. Open the Visual Studio Code terminal and paste the following command to create a virtual environment to host your MkDocs content:
35
37
```
36
38
python -m venv envname
@@ -72,21 +74,20 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
72
74
└─ mkdocs.yml
73
75
```
74
76
75
-
## Configuring your website
77
+
###Configuring your website
76
78
77
79
MkDocs provides many [configuration options](https://squidfunk.github.io/mkdocs-material/creating-your-site/#configuration) that you can use to create a beautiful website.
78
80
79
81
80
-
Open your `mkdocs.yml` file. The following output should display. We will add to it as we go.
82
+
Open your `mkdocs.yml` file. The following output should display. We will add to it as we go. Delete `site_url: https://mydomain.org/mysite` as you will not need it.
81
83
82
84
```
83
85
site_name: My documentation website
84
-
site_url: https://mydomain.org/mysite
85
86
theme:
86
87
name: material
87
88
```
88
89
89
-
### Configuring the color palette
90
+
####Configuring the color palette
90
91
91
92
Material for MkDocs provides two default color schemes: `default`, which is the light mode, and `slate` which is the dark mode.
92
93
@@ -96,11 +97,10 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
96
97
palette:
97
98
- scheme: default
98
99
```
99
-
Your file configuration should look like the following:
100
+
Your file configuration should look like the following.
100
101
101
102
```
102
103
site_name: My documentation website
103
-
site_url: https://mydomain.org/mysite
104
104
theme:
105
105
name: material
106
106
palette:
@@ -149,7 +149,6 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
149
149
150
150
```
151
151
site_name: My documentation website
152
-
site_url: https://mydomain.org/mysite
153
152
theme:
154
153
name: material
155
154
palette:
@@ -176,7 +175,7 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
176
175
name: Switch to light mode
177
176
```
178
177
179
-
### Configuring fonts
178
+
####Configuring fonts
180
179
181
180
Material for MkDocs integrates with [Google Fonts](https://fonts.google.com/) but you can also add custom fonts if you prefer.
182
181
@@ -193,7 +192,6 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
193
192
194
193
```
195
194
site_name: My documentation website
196
-
site_url: https://mydomain.org/mysite
197
195
theme:
198
196
name: material
199
197
palette:
@@ -222,7 +220,7 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
222
220
text: Roboto
223
221
```
224
222
225
-
### Configuring navigation
223
+
####Configuring navigation
226
224
227
225
MkDocs provides multiple ways to configure your website's navigation depending on the amount of content your website contains. Find out [all available configurations for navigation](https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/) on the MkDocs website.
228
226
@@ -239,8 +237,9 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
239
237
- How to perform action three: perform-action-three.md
240
238
```
241
239
242
-
### Configuring admonitions
240
+
####Configuring admonitions
243
241
242
+
An admonition also known as a call-out, is a graphical element used in user guides. It consists of a text block used to give a description or additional information to users.
244
243
You can use admonitions to add side content to your documentation or make parts you want your users to notice stand out more. Refer to the [documentation](https://squidfunk.github.io/mkdocs-material/reference/admonitions/?h=admonitions#admonition-icons) to see available admonition icons.
245
244
246
245
#### Enabling admonitions
@@ -276,7 +275,7 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
276
275
277
276
#### Using admonitions
278
277
279
-
The example below shows you the syntax you need to use in your files for admonitions. You can replace `info` with any of the admonitions you have added in the previous section (`abstract`, `note`, `tip`, `success`, `question`, `warning`, `failure`, `danger`, `bug`, `example`, and `quote`).
278
+
The example below shows you the syntax you need to use in your markdown files for admonitions. You can replace `info` with any of the admonitions you have added in the previous section (`abstract`, `note`, `tip`, `success`, `question`, `warning`, `failure`, `danger`, `bug`, `example`, and `quote`).
280
279
281
280
```
282
281
!!! info
@@ -289,20 +288,35 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
289
288
```
290
289
!!! info "Information about the admonition box"
291
290
292
-
I am an information admonition. You can use me to give additional information to your user.
291
+
I am an information admonition with a title. You can use me to give additional information to your user.
293
292
```
294
293
295
294
If you want your admonition box to be collapsible, you can use the code below. The user will only see the box without its content.
296
295
297
296
```
298
297
??? info
299
298
300
-
I am an information admonition. You can use me to give additional information to your user.
299
+
I am a collapsible information admonition. You can click the arrow to the right to expand me.
301
300
```
302
301
303
302
Find out more about admonitions on the [MkDocs website](https://squidfunk.github.io/mkdocs-material/reference/admonitions/?h=admonitions#configuration).
304
303
305
-
### Additional configuration
304
+
#### Adding images
305
+
306
+
You need to add the `glightbox` plugin in your `mkdocs.yml` file to add images and videos on your website. Find out how to add the plugin in the [section below](#additional-configuration).
307
+
308
+
You can add images in your markdown files using the following example:
309
+
```
310
+
{align=center, width="150", loading=lazy}
311
+
```
312
+
You can also add images inside collapsible admonitions. Notice that the image component is indented under the `info` text. Your image will not display if the indentation is incorrect.
313
+
```
314
+
??? info "Your example should look like the following"
315
+
{align=center, width="150", loading=lazy}
316
+
```
317
+
318
+
319
+
#### Additional configuration
306
320
307
321
You can add the following additional configuration options in your `mkdocs.yml` file. The `features` component allows you to use various features of the Material theme.
308
322
```
@@ -332,35 +346,93 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
If you have only added the elements shown in the sections above, you can copy the code below or use it as reference to make sure you have added everything correctly in your `mkdocs.yml` file.
352
+
353
+
```
354
+
site_name: My documentation website
355
+
theme:
356
+
name: 'material'
357
+
palette: # Palette toggle for light mode
358
+
- scheme: default
359
+
primary: black # Primary defines the primary color of the theme.
360
+
accent: purple # Accent specifies the accent color of the theme.
361
+
toggle: # toggle specifies the icon and name for toggling between light and dark modes.
362
+
icon: material/toggle-switch
363
+
name: Switch to dark mode
336
364
337
-
If you have only added the elements shown in the sections above, you can download the `mkdcos.yml` below.
365
+
# Palette toggle for dark mode
366
+
- scheme: slate
367
+
primary: white
368
+
accent: deep purple
369
+
toggle:
370
+
icon: material/toggle-switch-off-outline
371
+
name: Switch to light mode
372
+
font:
373
+
text: Roboto
374
+
nav: # Defines the navigation structure of the website, linking to the corresponding markdown files.
375
+
- Welcome to my documentation website: index.md
376
+
- My documentation website's FAQ: faq.md
377
+
- Understanding a concept in my documentation website: understanding-concept.md
378
+
- How to perform action one: perform-action-one.md
379
+
- How to perform action two: perform-action-two.md
380
+
- How to perform action three: perform-action-three.md
381
+
markdown_extensions:
382
+
- admonition
383
+
- pymdownx.details
384
+
- pymdownx.superfences
385
+
icon: # Maps custom MkDocs icons to different types of admonitions (alerts or messages), using icons from the Octicons set.
386
+
admonition:
387
+
note: octicons/tag-16
388
+
abstract: octicons/checklist-16
389
+
info: octicons/info-16
390
+
tip: octicons/squirrel-16
391
+
success: octicons/check-16
392
+
question: octicons/question-16
393
+
warning: octicons/alert-16
394
+
failure: octicons/x-circle-16
395
+
danger: octicons/zap-16
396
+
bug: octicons/bug-16
397
+
example: octicons/beaker-16
398
+
quote: octicons/quote-16
399
+
features:
400
+
- content.code.copy # Adds a copy button to code blocks.
<ahref="/tutorials/using-bucket-website-with-mkdocs/mkdocs-example.yml"target="_blank"rel="noopener noreferrer"download="mkdocs-example.yml"> Download the mkdocs file </a>
412
+
## Preview and deploy your website
340
413
341
-
</TabsTab>
342
-
<TabsTablabel="Preview and deploy your MkDocs website">
414
+
### Preview your website
343
415
344
416
Once your website's content is ready and configured, you can preview it to make sure that everything displays properly.
345
417
346
-
## Previewing and generating a static website
347
418
348
419
1. Open the folder containing your `docs` directory in Visual Studio Code. The one we have created in this tutorial is named `my-folder`.
349
420
2. Open the Visual Studio Code terminal and paste the following command:
350
421
```
351
422
mkdocs serve
352
423
```
353
-
3. Copy the localhost link that displays in the output into your browser. Your website should display.
424
+
3. Copy the localhost link (`http://127.0.0.1:8000/`) that displays in the output into your browser. Your website should display.
354
425
4. Check that everything on your website displays correctly and ensure that there are no broken links.
355
-
5. Run the following command in your terminal to generate your folder's content into a static website:
426
+
5. Hit `Control` and `C` to shut down the localhost.
427
+
6. Run the following command in your terminal to generate your folder's content into a static website:
356
428
```
357
429
mkdocs build
358
430
```
359
431
<Messagetype="note">
360
432
When you run the `mkdocs build` command, MkDocs processes your markdown files and other configurations specified in your `mkdocs.yml` file and outputs a complete static site in a directory named `site` by default.
361
433
</Message>
362
434
363
-
##Deploying your website
435
+
### Deploy your website
364
436
365
437
1.[Create an Object Storage bucket](/storage/object/how-to/create-a-bucket/) from the [Scaleway console](https://console.scaleway.com/).
366
438
2.[Enable](/storage/object/how-to/use-bucket-website/) the bucket website feature on your bucket.
@@ -374,7 +446,17 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
374
446
9. Once the transfer of your files is complete, cick the **Bucket settings** tab and scroll down to the **Bucket website** section.
375
447
10. Retrieve the URL of your website under **Website URL**.
376
448
377
-
</TabsTab>
378
-
</Tabs>
449
+
## Example of what your website should look like
450
+
451
+
Your website's homepage should look similar to the following in light mode:
452
+
<Lightboxsrc="scaleway-mkdocs-website-light-mode.webp"alt="MkDocs website in light mode" />
453
+
454
+
Your website's homepage should look similar to the following in dark mode:
455
+
<Lightboxsrc="scaleway-mkdocs-website-dark-mode.webp"alt="MkDocs website in dark mode" />
456
+
457
+
This is what a collapsible admonition with a custom title should look like when collapsed:
0 commit comments