-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
617 lines (428 loc) · 15.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<title>Building a Personal Website using Quarto</title>
<meta charset="utf-8" />
<meta name="author" content=" Kuan Liu Guest lecture - R workshop" />
<script src="index_files/header-attrs-2.28/header-attrs.js"></script>
<link href="index_files/remark-css-0.0.1/default.css" rel="stylesheet" />
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: { equationNumbers: { autoNumber: "AMS" } },
});
</script>
<style>
.mjx-mrow a {
color: black;
pointer-events: none;
cursor: default;
}
</style>
<link rel="stylesheet" href="assets/utoronto_fonts.css" type="text/css" />
<link rel="stylesheet" href="assets/utoronto.css" type="text/css" />
</head>
<body>
<textarea id="source">
class: center, middle, inverse, title-slide
.title[
# Building a Personal Website using Quarto
]
.author[
### <br>Kuan Liu<br> <br> Guest lecture - R workshop
]
.date[
### <br>Nov 24, 2024
]
---
## Front matters
- For this workshop we assume you know R and Rstudio.
- In this tutorial, we will learn how to build a simple personal website using Quarto and hosting the page on [GitHub](https://github.com/)
---
class: center, middle
## What is Quarto?
.purple[.bold[Quarto]] is an open-source scientific and technical publishing system built on [Pandoc](https://pandoc.org/)
--
.purple[.bold[Quarto]] is the **next generation of RMarkown**.
--
Publish high-quality .black[articles], .red[reports], .blue[presentations], .green[websites], .yello[blogs], and .orange[books] in HTML, PDF, MS Word, ePub, and more.
--
.purple[.bold[Quarto]] can author documents in plain text formats (**rmarkdown**, **markdown**) or mixed formats (**Jupyter** notebook) - .bold[more than just Rmarkdown!]
---
## What is Quarto?

---
## List of Quarto formats
- Basic documents in html, pdf, docx
- Presentations in beamer, pptx, and revealjs (html slides)
- .blue[.bold[Websites & Blogs]] in [Quarto Website](https://quarto.org/docs/websites/) and [Quarto Blogs](https://quarto.org/docs/websites/website-blog.html)
---
## Quarto > RMarkdown
**Quarto is a one-stop-shop that renders multiple output formats!**

---
class: ut-pantone_yellow
# .black[**Building Websites with Quarto**]
---
## Why not WordPress, Medium etc
- **Minimum Rmarkdown support**
- no ads, no login/password, no cost!
- fast building!
---
class: center, middle
## Quarto websites
**Convenient:** Documents published as part of a website share navigational elements, rendering options, and visual style.
--
**Features:** Website navigation through a global navbar, a sidebar with links, or both. You can also enable full text search for websites.
--
Example website: https://kuan-liu.github.io/biostat3/
--
**Host:** can be published to a wide variety of destinations including .purple[**GitHub Pages**], .green[**Netlify**], .blue[**RStudio Connect**], etc.
---
## Getting started
- Create a website
```
quarto create-project MySiteName --type website
```
- create a blog
```
quarto create-project MyBlogName --type website:blog
```
- or use RStudio \> New Project \> New Quarto Blog
---
class: left, ut-pantone_lime
## Try this - create Quarto website project
- Create a new RStudio project and select a new directory and Quarto website
- specify directory name with your GitHub account name plus **.github.io**, e.g., Kuan-Liu.github.io
- Explore the directory
---
## Navigation & Structure
- `_quarto.yml`, website configuration file
- provides website options such as website theme, navigation bar.
- index.qmd, home page of the website
- about.qmd, the about page of the website
- styles.css, Custom CSS for website (for advanced coder)
---
## Rendering posts and building webiste
- On a specific post, Render with RStudio \> Render
- Build tab \> Render/Preview Website (try)
These will preview the entire website
- "Freeze" is a feature to specify which file you would like to render at each built (fast & efficient building).
```
execute:
freeze: auto # re-render only when source changes
```
- Add `freeze: auto` to the _quato.yml file
---
## Themes
- My favourite two new themes: Zephyr and Quartz
- A list of build-in themes: https://quarto.org/docs/websites/website-blog.html#themes
- To change theme, modify the bottom of your website's `_quarto.yml`
``` yaml
format:
html:
theme: Zephyr
```
---
## About page templates
- list of themes: https://quarto.org/docs/websites/website-about.html
.pull-left[
### jolla
<img src="https://quarto.org/docs/websites/images/about-jolla.png" width="400px"/>
]
.pull-right[
### trestles
<img src="https://quarto.org/docs/websites/images/about-trestles.png" width="400px"/>
]
---
class: left, ut-pantone_lime
## Try this - customize the about page
- create a subfolder in your working directory called "images" and put a thumbnail photo in this folder (for example, HDWG.jpg).
- now updating the about page title section with
``` yaml
about:
template: jolla
image: images/HDWG.jpg
links:
- icon: twitter
text: twitter
href: https://twitter.com/
- icon: github
text: Github
href: https://github.com/
```
---
## Home page
- The home (landing) page for this website by default is generated following the `index.qmd` file
- We might want to feature about page as the landing page
- simply rename the qmd files about.qmd to index.qmd
- and rename index.qmd to anther tab of your website, for example publication or research
---
class: left, ut-pantone_lime
## Try this - Adding icons to social account
- You can add links to GitHub, Twitter, Google Scholar on the navigation bar with icon by updating the config file, `_quarto.yml`
``` yaml
navbar:
right:
- href: index.qmd
text: Home
- icon: github
href: https://github.com/my_user_name
- icon: twitter
href: https://twitter.com/my_user_name
```
---
## Blog posts
- you can add a quarto page to host blog posts by creating a blog.qmd file where you will display your blog posts in a listing.

---
## Listing
- There are three types of listing displays: default, table, and grid
.pull-left[
- Grid

]
.pull-right[
- Table

]
---
class: left, ut-pantone_lime
## Try this - creating a blog post
1. create blog.qmd and specify in the title section
```---
title: my blogs
listing:
contents: posts
sort: "date desc"
type: default
categories: true
---
```
2. create a sub folder name it "posts", under "posts" create another sub folder name it "blog1"
---
## Writing a post
1. inside blog1 folder try Blank File \> Quarto document and name it index.qmd ([example](https://kuan-liu.github.io/blog.html)).
- **This index.qmd will host content of your blog!**
2. specify in the title section of blog1/index.qmd
```---
title: "My first post with R"
description: "you can post a summary description here"
author: "Kuan"
date: "11/20/2023"
categories:
- R code
---
```
---
## Publishing - GitHub
- Use [GitHub Pages](https://quarto.org/docs/publishing/github-pages.html) when the source code for your document or site is hosted on GitHub repo.
- make sure to render your site (html files) in the docs folder
- in _quarto.yml specify `output-dir: docs`
- **Try this:**
1. Build your website and push to GitHub repo **github_account.github.io**
2. go to settings of the repo and select page. Specify Branch master and /docs and save!
3. Your site should be live at https://github_account.github.io.
---
class: left, ut-pantone_lime
## Try this - publishing your website on GitHub
- You can folk or download codes to build the [template Quarto website](https://kuan-liu.github.io/) I made for this tutorial at **https://github.com/Kuan-Liu/Kuan-Liu.github.io**.
---
class: ut-pantone_yellow
# .black[**Building Websites with blogdown**]
---
## What is blogdown?
- An R package for building website using R Markdown and [Hugo](https://gohugo.io/)
- building website via Hugo using Rmarkdown
- Hugo
- no cost, open-source, and easy to install
- tons of features for fancy customization if you are familiar with css (Cascading Style Sheets)
- example website: https://www.kuan-liu.com/
- blogdown book: https://bookdown.org/yihui/blogdown/
---
## Getting started
- Be sure that you have installed the **blogdown** package
``` r
install.packages("blogdown")
blogdown::install_hugo(version="0.86.0")
blogdown::hugo_version()
# if you have multiple version of hugo, you can specify which version to use;
# options(blogdown.hugo.version = '0.86.0')
```
- list of Hugo themes: https://themes.gohugo.io/
- for my personal website I used the [hello-friend-ng](https://themes.gohugo.io/themes/hugo-theme-hello-friend-ng/) theme
- go to https://themes.gohugo.io/ and take a quick look at all the amazing Hugo theme templates
---
class: left, ut-pantone_lime
## Try this - create a new blogdown project
.pull.left[
- create a new project, select website using blogdown, specify Hugo theme `hugo-apero/hugo-apero`
]
.pull.right[
<img src="assets\blogdown1.png" alt="drawing" width="500"/>
]
---
class: left, ut-pantone_lime
## Try this - building website
- explore the project structure
- try Knit the website
- subfolder *content* contents all markdown files or rmarkdown files for your website
---
## Publishing on Netlify
- create and upload repo on GitHub via GitHub desktop
- log in to your netlify account via GitHub!
- select add new site \> import an existing project \> connect to GitHub \> select repo
- update domains names
<img src="assets\netlify.png" alt="drawing" width="560"/>
---
class: left, ut-pantone_lime
## Live demo - pulishing website on Netlify
---
## Acknowledgement
- "Permanent link" to the slides at https://kuan-liu.github.io/Quarto_website_workshop/
- Credit: This template and tutorial is created based on [Tom Mock](https://rstudio-conf-2022.github.io/get-started-quarto/)
---
background-image: url("https://arthistory.utoronto.ca/sites/arthistory.utoronto.ca/files/styles/slider_large_img/public/front_carousel/HH01.jpg?itok=ukdDyPF0")
background-position: bottom
background-size: contain
## Thank you!
- Materials for this workshop
- [online slides](https://kuan-liu.github.io/Quarto_website_workshop/#1)
- [Quarto template personal page repo](https://github.com/Kuan-Liu/Kuan-Liu.github.io)
- [Quarto template personal page](https://kuan-liu.github.io/)
</textarea>
<style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>var slideshow = remark.create({
"highlightStyle": "github",
"highlightLines": true,
"countIncrementalSlides": false,
"ratio": "4:3",
"navigation": {
"scroll": true
}
});
if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
window.dispatchEvent(new Event('resize'));
});
(function(d) {
var s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
if (!r) return;
s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
d.head.appendChild(s);
})(document);
(function(d) {
var el = d.getElementsByClassName("remark-slides-area");
if (!el) return;
var slide, slides = slideshow.getSlides(), els = el[0].children;
for (var i = 1; i < slides.length; i++) {
slide = slides[i];
if (slide.properties.continued === "true" || slide.properties.count === "false") {
els[i - 1].className += ' has-continuation';
}
}
var s = d.createElement("style");
s.type = "text/css"; s.innerHTML = "@media print { .has-continuation { display: none; } }";
d.head.appendChild(s);
})(document);
// delete the temporary CSS (for displaying all slides initially) when the user
// starts to view slides
(function() {
var deleted = false;
slideshow.on('beforeShowSlide', function(slide) {
if (deleted) return;
var sheets = document.styleSheets, node;
for (var i = 0; i < sheets.length; i++) {
node = sheets[i].ownerNode;
if (node.dataset["target"] !== "print-only") continue;
node.parentNode.removeChild(node);
}
deleted = true;
});
})();
// add `data-at-shortcutkeys` attribute to <body> to resolve conflicts with JAWS
// screen reader (see PR #262)
(function(d) {
let res = {};
d.querySelectorAll('.remark-help-content table tr').forEach(tr => {
const t = tr.querySelector('td:nth-child(2)').innerText;
tr.querySelectorAll('td:first-child .key').forEach(key => {
const k = key.innerText;
if (/^[a-z]$/.test(k)) res[k] = t; // must be a single letter (key)
});
});
d.body.setAttribute('data-at-shortcutkeys', JSON.stringify(res));
})(document);
(function() {
"use strict"
// Replace <script> tags in slides area to make them executable
var scripts = document.querySelectorAll(
'.remark-slides-area .remark-slide-container script'
);
if (!scripts.length) return;
for (var i = 0; i < scripts.length; i++) {
var s = document.createElement('script');
var code = document.createTextNode(scripts[i].textContent);
s.appendChild(code);
var scriptAttrs = scripts[i].attributes;
for (var j = 0; j < scriptAttrs.length; j++) {
s.setAttribute(scriptAttrs[j].name, scriptAttrs[j].value);
}
scripts[i].parentElement.replaceChild(s, scripts[i]);
}
})();
(function() {
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
if (/^(https?:)?\/\//.test(links[i].getAttribute('href'))) {
links[i].target = '_blank';
}
}
})();
// adds .remark-code-has-line-highlighted class to <pre> parent elements
// of code chunks containing highlighted lines with class .remark-code-line-highlighted
(function(d) {
const hlines = d.querySelectorAll('.remark-code-line-highlighted');
const preParents = [];
const findPreParent = function(line, p = 0) {
if (p > 1) return null; // traverse up no further than grandparent
const el = line.parentElement;
return el.tagName === "PRE" ? el : findPreParent(el, ++p);
};
for (let line of hlines) {
let pre = findPreParent(line);
if (pre && !preParents.includes(pre)) preParents.push(pre);
}
preParents.forEach(p => p.classList.add("remark-code-has-line-highlighted"));
})(document);</script>
<script>
slideshow._releaseMath = function(el) {
var i, text, code, codes = el.getElementsByTagName('code');
for (i = 0; i < codes.length;) {
code = codes[i];
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
text = code.textContent;
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
/^\$\$(.|\s)+\$\$$/.test(text) ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
code.outerHTML = code.innerHTML; // remove <code></code>
continue;
}
}
i++;
}
};
slideshow._releaseMath(document);
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML';
if (location.protocol !== 'file:' && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName('head')[0].appendChild(script);
})();
</script>
</body>
</html>