Skip to content

Commit 629621c

Browse files
committed
docs(tuto): review team
1 parent 03425e4 commit 629621c

File tree

6 files changed

+114
-88
lines changed

6 files changed

+114
-88
lines changed
73 KB
Loading
70.3 KB
Loading
478 KB
Loading
410 KB
Loading

tutorials/using-bucket-website-with-mkdocs/index.mdx

Lines changed: 114 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
2424

2525
- A Scaleway account logged into the [console](https://console.scaleway.com)
2626
- [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
27+
- [Installed Python](https://www.python.org/downloads/)
28+
- [Installed pip](https://pip.pypa.io/en/stable/installation/)
29+
- [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
3135

32-
<Tabs id="install">
33-
<TabsTab label="Set up MkDocs and configure your website">
3436
1. Open the Visual Studio Code terminal and paste the following command to create a virtual environment to host your MkDocs content:
3537
```
3638
python -m venv envname
@@ -72,21 +74,20 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
7274
└─ mkdocs.yml
7375
```
7476

75-
## Configuring your website
77+
### Configuring your website
7678

7779
MkDocs provides many [configuration options](https://squidfunk.github.io/mkdocs-material/creating-your-site/#configuration) that you can use to create a beautiful website.
7880

7981

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

8284
```
8385
site_name: My documentation website
84-
site_url: https://mydomain.org/mysite
8586
theme:
8687
name: material
8788
```
8889

89-
### Configuring the color palette
90+
#### Configuring the color palette
9091

9192
Material for MkDocs provides two default color schemes: `default`, which is the light mode, and `slate` which is the dark mode.
9293

@@ -96,11 +97,10 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
9697
palette:
9798
- scheme: default
9899
```
99-
Your file configuration should look like the following:
100+
Your file configuration should look like the following.
100101

101102
```
102103
site_name: My documentation website
103-
site_url: https://mydomain.org/mysite
104104
theme:
105105
name: material
106106
palette:
@@ -149,7 +149,6 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
149149

150150
```
151151
site_name: My documentation website
152-
site_url: https://mydomain.org/mysite
153152
theme:
154153
name: material
155154
palette:
@@ -176,7 +175,7 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
176175
name: Switch to light mode
177176
```
178177

179-
### Configuring fonts
178+
#### Configuring fonts
180179

181180
Material for MkDocs integrates with [Google Fonts](https://fonts.google.com/) but you can also add custom fonts if you prefer.
182181

@@ -193,7 +192,6 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
193192

194193
```
195194
site_name: My documentation website
196-
site_url: https://mydomain.org/mysite
197195
theme:
198196
name: material
199197
palette:
@@ -222,7 +220,7 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
222220
text: Roboto
223221
```
224222

225-
### Configuring navigation
223+
#### Configuring navigation
226224

227225
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.
228226

@@ -239,8 +237,9 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
239237
- How to perform action three: perform-action-three.md
240238
```
241239

242-
### Configuring admonitions
240+
#### Configuring admonitions
243241

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.
244243
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.
245244

246245
#### Enabling admonitions
@@ -276,7 +275,7 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
276275

277276
#### Using admonitions
278277

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`).
280279

281280
```
282281
!!! info
@@ -289,20 +288,35 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
289288
```
290289
!!! info "Information about the admonition box"
291290
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.
293292
```
294293

295294
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.
296295

297296
```
298297
??? info
299298
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.
301300
```
302301

303302
Find out more about admonitions on the [MkDocs website](https://squidfunk.github.io/mkdocs-material/reference/admonitions/?h=admonitions#configuration).
304303

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+
![Description of your image for accessibility purposes or leave this field empty](/folder-where-your-image-is-located/name-pf-image.png){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+
![Description of your image for accessibility purposes or leave this field empty](/folder-where-your-image-is-located/name-pf-image.png){align=center, width="150", loading=lazy}
316+
```
317+
318+
319+
#### Additional configuration
306320

307321
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.
308322
```
@@ -332,35 +346,93 @@ Find out how to Set up MkDocs and configure your website in the first tab, then
332346
copyright: >
333347
Copyright &copy; 2016 - 2024 Martin Donath
334348
```
335-
## Downloading the mkdocs file template
349+
### Template of the mkdocs.yaml file
350+
351+
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
336364
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.
401+
- navigation.sections # Enables section-based navigation.
402+
- navigation.path # Shows the navigation path (breadcrumbs).
403+
- navigation.top # Adds a "back to top" button.
404+
- search.suggest # Enables search suggestions.
405+
plugins: # Lists the MkDocs plugins enabled for the site.
406+
- search # Adds search functionality.
407+
- glightbox # Adds lightbox functionality for images and videos.
408+
copyright: >
409+
Copyright &copy; 2016 - 2024 Martin Donath
410+
```
338411

339-
<a href="/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
340413

341-
</TabsTab>
342-
<TabsTab label="Preview and deploy your MkDocs website">
414+
### Preview your website
343415

344416
Once your website's content is ready and configured, you can preview it to make sure that everything displays properly.
345417

346-
## Previewing and generating a static website
347418

348419
1. Open the folder containing your `docs` directory in Visual Studio Code. The one we have created in this tutorial is named `my-folder`.
349420
2. Open the Visual Studio Code terminal and paste the following command:
350421
```
351422
mkdocs serve
352423
```
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.
354425
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:
356428
```
357429
mkdocs build
358430
```
359431
<Message type="note">
360432
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.
361433
</Message>
362434

363-
## Deploying your website
435+
### Deploy your website
364436

365437
1. [Create an Object Storage bucket](/storage/object/how-to/create-a-bucket/) from the [Scaleway console](https://console.scaleway.com/).
366438
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
374446
9. Once the transfer of your files is complete, cick the **Bucket settings** tab and scroll down to the **Bucket website** section.
375447
10. Retrieve the URL of your website under **Website URL**.
376448

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+
<Lightbox src="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+
<Lightbox src="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:
458+
<Lightbox src="scaleway-collapsible-admonition.webp" alt="" />
379459

460+
This is what a collapsible admonition with a custom title should look like when expanded:
461+
<Lightbox src="scaleway-collapsible-admonition-expanded.webp" alt="" />
380462

tutorials/using-bucket-website-with-mkdocs/mkdocs-example.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)