Skip to content

Commit 09a76f6

Browse files
committed
feat(media): finished writing page
1 parent e6e9444 commit 09a76f6

1 file changed

Lines changed: 52 additions & 33 deletions

File tree

pages/media/index.qmd

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,30 @@
22
title: Images, videos and documents
33
---
44

5+
::: {.pale-blue}
6+
7+
**On this page we will:**
8+
9+
* Add images with different sizes, captions and alt text.
10+
* Embed videos using shortcodes.
11+
* Embed other websites using iframes.
12+
* Display PDFs inside a page.
13+
14+
:::
15+
516
You should complete the listed tasks in the `4_images_videos_documents.qmd` file on your Codespace. Once you have worked through these tasks, commit and push your change.
617

718
## Images
819

9-
You can add images to a Quarto page using Markdown.
10-
The basic pattern is:
20+
You can add images to a Quarto page using Markdown. The basic pattern is:
1121

1222
```markdown
1323
![](image.jpg)
1424
```
1525

1626
In this example, we have an image file called `south_cloisters.jpg` in the `images` folder. The path to the file is:
1727

18-
* `..` meaning "go up one folder".
28+
* `/` means "start from the root of the website", not from the folder of this `.qmd` file.
1929
* `images` is the folder name.
2030
* `south_cloisters.jpg` is the file name.
2131

@@ -24,64 +34,66 @@ If your image is in the same folder as your `.qmd` file, you could just write th
2434
This shows the image at its default size and alignment:
2535

2636
```markdown
27-
![](../images/south_cloisters.jpg)
37+
![](/images/south_cloisters.jpg)
2838
```
2939

30-
![](../images/south_cloisters.jpg){fig-alt="Default size and alignment example"}
40+
![](/images/south_cloisters.jpg){fig-alt="Default size and alignment example"}
3141

32-
You can control the size of the image with `width`:
42+
### Customising image display
3343

34-
TODO: EXPLAIN CURLY BRACES
44+
After the image, you can add options inside **curly braces** { }. These options tell Quarto how to display the image.
45+
46+
You can control the size of the image with `width`:
3547

3648
```markdown
37-
![](../images/south_cloisters.jpg){width=50%}
49+
![](/images/south_cloisters.jpg){width=50%}
3850
```
3951

40-
![](../images/south_cloisters.jpg){width=50% fig-alt="Custom width example"}
52+
![](/images/south_cloisters.jpg){width=50% fig-alt="Custom width example"}
4153

42-
To add a caption, put text inside the square brackets:
54+
We can control alignment using `fig-align`:
4355

4456
```markdown
45-
![Photograph of South Cloisters on St Lukes Campus](../images/south_cloisters.jpg)
57+
![](/images/south_cloisters.jpg){fig-align="center"}
4658
```
4759

48-
![Photograph of South Cloisters on St Lukes Campus](../images/south_cloisters.jpg){fig-alt="Caption example"}
60+
![](/images/south_cloisters.jpg){fig-align="center" fig-alt="Centered figure example"}
4961

50-
We can control alignment using `fig-align`:
62+
Adding `.lightbox` lets people click to see a larger version of the image - helpful when you have detailed figures or diagrams.
5163

5264
```markdown
53-
![](../images/south_cloisters.jpg){fig-align="center"}
65+
![](/images/south_cloisters.jpg){.lightbox}
5466
```
5567

56-
![](../images/south_cloisters.jpg){fig-align="center" fig-alt="Centered figure example"}
68+
![](/images/south_cloisters.jpg){.lightbox fig-alt="Lightbox example"}
5769

58-
Adding `.lightbox` lets people click to see a larger version of the image - helpful when you have detailed figures or diagrams.
70+
To add a caption, put text inside the square brackets:
5971

6072
```markdown
61-
![](../images/south_cloisters.jpg){.lightbox}
73+
![Photograph of South Cloisters on St Lukes Campus](/images/south_cloisters.jpg)
6274
```
6375

64-
![](../images/south_cloisters.jpg){.lightbox fig-alt="Lightbox example"}
76+
![Photograph of South Cloisters on St Lukes Campus](/images/south_cloisters.jpg){fig-alt="Caption example"}
6577

6678
You can also make your figure a hyperlink:
6779

6880
```markdown
69-
[![](../images/south_cloisters.jpg)](https://medicine.exeter.ac.uk/research/facilities/southcloisters/)
81+
[![](/images/south_cloisters.jpg)](https://medicine.exeter.ac.uk/research/facilities/southcloisters/)
7082
```
7183

72-
[![](../images/south_cloisters.jpg)](https://medicine.exeter.ac.uk/research/facilities/southcloisters/){fig-alt="Linked image example"}
84+
[![](/images/south_cloisters.jpg)](https://medicine.exeter.ac.uk/research/facilities/southcloisters/){fig-alt="Linked image example"}
7385

7486
To add alternative text to your image:
7587

7688
```markdown
77-
![](../images/south_cloisters.jpg){fig-alt="Photograph of South Cloisters on St Lukes Campus"}
89+
![](/images/south_cloisters_broken.jpg){fig-alt="Photograph of South Cloisters on St Lukes Campus"}
7890
```
7991

80-
![](../images/south_cloisters.jpg){fig-alt="Photograph of South Cloisters on St Lukes Campus"}
92+
![](/images/south_cloisters_broken.jpg){fig-alt="Photograph of South Cloisters on St Lukes Campus"}
8193

8294
::: {.pale-blue}
8395

84-
**Task**: Open `media.qmd`, see image is provided in images folder
96+
**Task**:
8597

8698
* [ ] Add image at full width
8799
* [ ] Add it again, 40% width, aligned to right
@@ -93,9 +105,11 @@ Render the page and compare how the three images look.
93105

94106
## Videos
95107

96-
You can embed videos (for example, from YouTube) using the `video` shortcode. It will show a video player inside your page. Here is an example:
108+
You can embed videos (for example, from YouTube) using the `video` shortcode. It will show a video player inside your page.
97109

98-
TODO: EXPLAIN WHAT A SHORTCODE IS
110+
A **shortcode** is a special, compact bit of text that Quarto understands and expands into more complex HTML for you. You do not have to write the HTML yourself; you just use the shortcode and pass it the video URL.
111+
112+
Here is an example:
99113

100114
```{.markdown shortcodes="false"}
101115
{{< video https://youtu.be/BUN0sSa2e9c?si=-o7gu4FGOZS7L2rt >}}
@@ -105,7 +119,7 @@ TODO: EXPLAIN WHAT A SHORTCODE IS
105119

106120
::: {.pale-blue}
107121

108-
**Task**: On `media.qmd`:
122+
**Task**:
109123

110124
* [ ] Add a YouTube video to the page - for example:
111125

@@ -119,9 +133,12 @@ Render the page and check that the video player appears.
119133

120134
## Embed websites
121135

122-
Sometimes you might want to show another website (e.g., news article, uni web page, etc.) inside your page. You can do this using an HTML `<iframe>`.
136+
Sometimes you might want to show another website (e.g., news article, university web page, etc.) inside your page. You can do this using an HTML `<iframe>`.
137+
138+
An **iframe** is like a little browser window inside your page: it loads another web page within a box.
123139

124-
TODO: beginner friendly explanation of HTML syntax and of iframes
140+
Basic HTML syntax uses tags like `<tagname> ... </tagname>`.
141+
Here, `<iframe ...></iframe>` is a tag that tells the browser to embed another page.
125142

126143
```markdown
127144
<iframe width="100%" height="500" src="https://quarto.org/" title="Quarto Documentation"></iframe>
@@ -131,7 +148,7 @@ TODO: beginner friendly explanation of HTML syntax and of iframes
131148

132149
::: {.pale-blue}
133150

134-
**Task**: On `media.qmd`:
151+
**Task**:
135152

136153
* [ ] Embed a website of your choice using an `<iframe>`.
137154
* [ ] Change the `height` to a different value (e.g., `200`) and see how it changes the space used on the page.
@@ -140,7 +157,7 @@ TODO: beginner friendly explanation of HTML syntax and of iframes
140157

141158
::: {.callout-note title="Advanced Extra: Wrapper" collapse="true"}
142159

143-
Sometimes you may want a header above the iframe.... distinguish embedded page from yours... give it more formal... e.g., open in new tab etc... here is an example wrapper adapted from https://github.com/andrewheiss/ath-quarto/blob/main/cv/index.qmd
160+
Sometimes you may want a header above the iframe to make it clear that this is an embedded page and to offer a link to open it in a new tab. Here is an example wrapper (adapted from [here](https://github.com/andrewheiss/ath-quarto/blob/main/cv/index.qmd)):
144161

145162
````markdown
146163
```{=html}
@@ -197,7 +214,7 @@ You can embed a PDF so that it appears inside the page. The simplest way (using
197214

198215
::: {.callout-note title="Advanced Extra: Responsive Container" collapse="true"}
199216

200-
If you want more control (for example, a responsive container), you can use CSS:
217+
If you want more control (for example, a responsive container that adjusts with the screen size), you can use CSS like this:
201218

202219
```
203220
.embed-container {
@@ -222,8 +239,10 @@ If you want more control (for example, a responsive container), you can use CSS:
222239

223240
::: {.pale-blue}
224241

225-
**Task**: we have provided a pdf namem ... on `media.qmd`:
242+
**Task**:
226243

227-
* [ ] Embed the example PDF.
244+
* [ ] Download the PDF above.
245+
* [ ] Copy the PDF into your GitHub codespace - for example, saving it under `pages/`.
246+
* [ ] Embed thhis example PDF in your page.
228247

229248
:::

0 commit comments

Comments
 (0)