Skip to content

Commit 9c33ac2

Browse files
committed
feat(customising): finished writing page
1 parent c38ef33 commit 9c33ac2

1 file changed

Lines changed: 141 additions & 3 deletions

File tree

pages/customising/index.qmd

Lines changed: 141 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,122 @@ title: "Exercise 6. Customising the site appearance"
1212

1313
:::
1414

15+
There are endless ways to customise how your Quarto site looks and behaves. This page introduces a few common options (like favicons, navigation, themes, and layout), but there is much more you can explore in the Quarto documentation, by looking at example sites, or by asking for help (including from AI tools) with small bits of HTML, CSS, or JavaScript. As you experiment, remember the goal here is not to write lots of code, but to make a few simple, readable tweaks that improve how your site feels for you and your readers.
16+
17+
## Favicon
18+
19+
A **favicon** is the small icon that appears in the browser tab next to your site title.
20+
21+
For a Quarto website, you set this in `_quarto.yml` using the `favicon` option inside the `website:` section. For example:
22+
23+
```{.yaml}
24+
website:
25+
title: "Site title"
26+
favicon: images/favicon.png
27+
```
28+
29+
Favicons are usually **square** images (e.g., 16x16, 32x32, or 48x48 pixels), saved as **PNG** so transparent backgrounds are supported. They do not need to be large; browsers will scale them down to a tiny size for the tab icon.
30+
31+
::: {.pale-blue}
32+
33+
**Task**:
34+
35+
* [ ] Set the favicon to `images/exeter.png` in `_quarto.yml`.
36+
* [ ] Render the site and check that the icon appears in the browser tab.
37+
38+
:::
39+
40+
## Navbar
41+
42+
So far, your pages have mainly appeared in the **sidebar**. You can also add links to the **navbar** across the top of the site by configuring the `navbar` section under `website:` in `_quarto.yml`
43+
44+
Right now, the navbar only shows a link to the GitHub repository and a search icon. To add pages, you choose whether links appear on the `left` or `right`, then list the pages you want there.
45+
46+
For example, this creates a navbar link to an About page:
47+
48+
```{.yaml}
49+
website:
50+
navbar:
51+
left:
52+
- about.qmd
53+
```
54+
55+
In this case, Quarto will use the page’s title (from its YAML front matter) as the label in the navbar. If you want to control the label explicitly, use `href` for the file path and `text` for the label:
56+
57+
```{.yaml}
58+
website:
59+
navbar:
60+
left:
61+
- href: about.qmd
62+
text: About
63+
```
64+
65+
::: {.pale-blue}
66+
67+
**Task:**
68+
69+
* [ ] Create a new page called `about.qmd`.
70+
* [ ] Add that page to the navbar in `_quarto.yml`.
71+
* [ ] Render the site and check that the new link appears in the top navigation and works.
72+
73+
:::
74+
75+
## Announcement
76+
77+
An **announcement bar** is a horizontal strip at the top of your site that shows an important message. It’s useful for things like:
78+
79+
* A status message (e.g., "This site is a work in progress").
80+
* A short disclaimer (e.g., a research project site that shows a note on every page about generalisability and how the results can be reused - [example](https://ambmodels.github.io/ambdes/)).
81+
* Course or event information (e.g., a training course site that uses it to provide information on upcoming HSMA dates and registration details - [example](https://hsma.co.uk/)).
82+
83+
You can configure it in `_quarto.yml` under `website:``announcement:`. For example:
84+
85+
```{.yaml}
86+
website:
87+
announcement:
88+
content: "**Note:** This site is a work in progress." # <1>
89+
dismissable: false # <2>
90+
position: below-navbar # <3>
91+
```
92+
93+
1. **Content:** The text shown in the bar. You can use simple Markdown for bold (`** **`) or links (`[]()`).
94+
2. **Dismissable:** If `true`, visitor will see a little "x" and can close the bar. If `false`, it always stays visible.
95+
3. **Position:** Where the bar appears - e.g., `below-navbar`, `above-navbar`.
96+
97+
You can find more announcement options (such as icons and types like "info" or "warning") in the [Quarto documentation](https://quarto.org/docs/reference/projects/websites.html#announcement).
98+
99+
::: {.pale-blue}
100+
101+
**Task:**
102+
103+
* [ ] Add an announcement bar to your site.
104+
105+
:::
106+
107+
## Footer
108+
109+
A **footer** is a small block of text that appears at the bottom of each page, often used for things like copyright, licences, or contact links.
110+
111+
In Quarto websites, you can add footer content using `page-footer` within the `website:` section in `_quarto.yml`. For example:
112+
113+
```{.yaml}
114+
website:
115+
page-footer:
116+
left: "This work was funded by XYZ."
117+
center: "Licence: CC-BY-SA 4.0."
118+
right: "Contact us at email@email.com."
119+
```
120+
121+
This creates a three-part footer: text on the left, centre, and right of the footer area. See the [Quarto documentation](https://quarto.org/docs/reference/projects/websites.html#footer) for more customisation options.
122+
123+
::: {.pale-blue}
124+
125+
**Task:**
126+
127+
* [ ] Add a footer to your site.
128+
129+
:::
130+
15131
## Themes
16132

17133
Quarto websites use a **theme** to control the general look (fonts, colours, spacing). You can view a list of available themes at <https://quarto.org/docs/output-formats/html-themes.html>.
@@ -125,11 +241,31 @@ You can also browse through them below:
125241

126242
:::
127243

128-
## CSS
244+
## Page width
129245

130-
## Colours and headings
246+
By default, Quarto uses a content width that is comfortable for reading. You can change this layout using the [`page-layout` option](https://quarto.org/docs/output-formats/page-layout.html).
131247

132-
## Page width
248+
For example, to make the content span the full width of the page:
249+
250+
```{.bash}
251+
format:
252+
html:
253+
page-layout: full
254+
```
255+
256+
You can set this:
257+
258+
* In a single page (inside that page's YAML front matter, alongside title).
259+
* Or for the whole site (inside `_quarto.yml` under `format:``html:`).
260+
261+
::: {.pale-blue}
262+
263+
**Task**:
264+
265+
* [ ] Set `page-layout: full` for either one page or the whole site.
266+
* [ ] Render and compare how the content looks before and after.
267+
268+
:::
133269

134270
## Styled spans
135271

@@ -141,6 +277,8 @@ You can use inline HTML with a `style` attribute:
141277
Highlight <span style="background: yellow;">this bit</span>.
142278
```
143279

280+
**Output:** Highlight <span style="background: yellow;">this bit</span>.
281+
144282
::: {.pale-blue}
145283

146284
**Task:**

0 commit comments

Comments
 (0)