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
Copy file name to clipboardExpand all lines: pages/basic_structure.qmd
+24-75Lines changed: 24 additions & 75 deletions
Original file line number
Diff line number
Diff line change
@@ -2,55 +2,27 @@
2
2
title: Basic structure
3
3
---
4
4
5
-
## Introduction to RStudio
5
+
::: {.pale-blue}
6
6
7
-
TODO
7
+
**On this page we will:**
8
8
9
-
<!-- Rough notes...
9
+
* Understand the two core files in a basic Quarto website.
10
+
* Learn how to render and preview the website.
10
11
11
-
BE SUPER CLEAR that this is just somewhere to run quarto and that focus of this session is not on code (though will do at the very end).
12
-
13
-
If youre not someone who has coded / used R
14
-
no worry
15
-
not needed for session
16
-
and not needed for quarto
17
-
18
-
so why are we using rstudio?
19
-
20
-
explain- need an IDE - one of the really cool things they can do is include executable code e.g., R and Python - come onto that at the end - but also, can make sites without
21
-
22
-
best interfaces for making quarto sites? things like rstudio, positron and vscode.
23
-
they just are what exist.
24
-
25
-
explain basic interface
26
-
- text editor
27
-
- console / terminal / background jobs - explain each
28
-
- environment
29
-
- files, help, plots
30
-
31
-
we are going to look at files...
32
-
-->
33
-
34
-
## Introduce to Quarto websites
35
-
36
-
We'll be creating a **Quarto website**, but it's worth knowing that Quarto can produce many things. See the [Quarto documentation](https://quarto.org/docs/guide/) for examples - options include:
12
+
:::
37
13
38
-
* Presentations
39
-
* Dashboards
40
-
* Manuscripts
41
-
* Documents
42
-
* Books
14
+
<br>
43
15
44
-
A simple website project just needs **two key files**:
16
+
We'll be creating a **Quarto website**. A simple website project just needs two key files:
45
17
46
18
1.`_quarto.yml`
47
19
2.`index.qmd`
48
20
49
-
###`_quarto.yml`
21
+
## `_quarto.yml`
50
22
51
23
This is file defines your **project settings** and **website structure**.
52
24
53
-
TODO: Add explanation. A yml file is YAML. plain text format. uses key-value pairs to store settings. YAML ("YAML Ain't Markup Language") is a simple format using key–value pairs, like:
25
+
The file uses YAML, which is just a plain text format for settings, written as **key: value** pairs, for example `title: My website`. Indentation (spaces at the start of a line) shows that something belongs "inside" something else, a bit like folders within folders.
54
26
55
27
Below is an example from [quarto-template](https://github.com/pythonhealthdatascience/quarto-template){target="_blank"}. Hover over each line to see an explanation:
56
28
@@ -113,21 +85,15 @@ book:
113
85
114
86
:::
115
87
116
-
### `index.qmd`
88
+
## `index.qmd`
117
89
118
-
A `.qmd` file is a **Quarto Markdown** document.
90
+
A `.qmd` file is a **Quarto Markdown** document. It mixes metadata at the top, text, and (optionally) code. For a website, `index.qmd` is treated as the **homepage:** when someone visits the root of your site, Quarto serves `index.html`, which comes from `index.qmd.
119
91
120
92
> If you're familiar with R Markdown (`.Rmd`), these are similar, but `.qmd` is more flexible.
121
93
122
-
`index.qmd`servers as the **homepage** of your website.
123
-
124
-
Each `.qmd` file begins with **YAML front matter**, enclosed by three dashes (`---`). This defines metadata such as the page title.
94
+
Each `.qmd` file begins with **YAML front matter**, enclosed by three dashes (`---`). This defines metadata such as the page title. Below that is the page. Here we just have one sentence: `This is my homepage.`.
125
95
126
-
> Alternative way of doing this would be `# My homepage`. TODO: SO WHY DO IT IN YAML?
127
-
128
-
Below that is the page. Here we just have one sentence: `This is my homepage.`.
129
-
130
-
```qmd
96
+
```{.r}
131
97
---
132
98
title: My homepage
133
99
---
@@ -138,41 +104,24 @@ This is my homepage.
138
104
139
105
## Rendering your website
140
106
141
-
**Rendering** means converting your Quarto source files into the final website - a colelction of `.html` pages that live inside a folder called `_site`.
142
-
143
-
To render in RStudio...
144
-
145
-
1. Open `index.qmd` in the editor.
146
-
147
-
[SCREENSHOT]
107
+
**Rendering** means converting your Quarto source files into the final website - a colelction of `.html` pages that live inside a folder called `_site`. There are two ways to do this.
148
108
149
-
2. Click the blue **Render** button (the arrow icon) at the top of the editor.
109
+
**Option 1: Preview button.** Open `index.qmd` in the editor, and click the **Preview** button in the top right hand corner
150
110
151
-
[SCREENSHOT]
111
+

152
112
153
-
RStudio will:
113
+
**Option 2: Terminal.** In the bottom panel, ensure you are on the **Terminal** tab. The Terminal is a place where you type commands instead of clicking buttons. We just need to type `quarto preview` then press <kbd>Enter</kbd> on your keyboard.
154
114
155
-
* Create the `_sites/` folder containing your rendered site.
156
-
* Open a **live preview** in your browser.
115
+

157
116
158
-
TODO: EXPLAIN LIVE PREVIEW url... its local host... display via browser...
159
-
160
-
::: {.callout-tip title="Troubleshooting"}
161
-
162
-
The preview may not open automatically if your browser blocks the pop-up. To resolve this, you should either:
163
-
164
-
* Click to allow pop-ups in your browsers, then click **Render** again.
165
-
* Go to the **Background Jobs** tab in the bottom left. This is where lgos from rendering quarot site are shown. Here, you will find the preview URL. Copy and paste this into browser.
166
-
167
-
:::
117
+
After either of these, you should see it says **Preparing to preview** and runs through files. It is creating `_sites/` folder containing your rendered site. Then when it is done, green text saying `Browse at ...`.
168
118
169
-
[SCREENSHOT]
119
+

170
120
171
-
### Rendering from the terminal
121
+
Open that link, by doing <kbd>Ctrl</kbd> and click, or by simply copying and pasting the link into your web browser.
172
122
173
-
You can also build your site using command-line tools. The terminal is simply a text-based way to type commands directly, rather than clicking buttons.
123
+
This will open a **live preview** of your site in the browser. Keep the browser open while you edit; every time you save a Quarto file, the preview will auto-refresh so you can immediately see your changes without re-running any commands.
174
124
175
-
Two helpful commands are:
125
+
Nothing is public yet; this preview only runs on your own computer. In other words, you are the only person who can see this site right now, and it will not appear on the internet until you deliberately publish or upload the rendered files somewhere.
176
126
177
-
* `quarto render` - builds your website.
178
-
* `quarto preview` - builds and opens a live-updating preview.
0 commit comments