-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.qmd
85 lines (69 loc) · 2.34 KB
/
index.qmd
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
---
title: "Slides"
description: |
This gallery features a collection of slide decks made with a variety of publishing tools.
Accompanying talks can be found at [silviacanelon.com](https://silviacanelon.com/talk).
listing:
contents:
- "metadata.yml"
type: grid
fields: [date, title, subtitle, image, categories]
sort: "date desc"
image-height: 100%
image-placeholder: img/social-card.png
#categories: unnumbered
page-layout: full
include-in-header: assets/umami.html
execute:
freeze: false
warning: false
echo: false
title-block-banner: false
header-includes: >
<link rel="stylesheet" href="assets/listing-default.css">
resources:
- assets/listing-default.css
---
<!--
::: {.callout-caution collapse="true"}
## Under construction
I've just noticed an issue with slide decks unintentionally sharing RevealJS theming across this site. This means some RevealJS slide decks are not styled as intended and may not be easy to read.
Thanks for your patience while I figure out what's going on!
:::
-->
```{r import-manual-redirects}
manual_redirects <-
readr::read_table(here::here("static", "_manualredirects.txt"),
col_names = FALSE) |>
dplyr::mutate(redirect = paste0(X1, " ", X2, " ", X3))
manual_redirects <- manual_redirects$redirect
```
```{r write-redirects}
# adapted from Tom Mock: https://github.com/jthomasmock/themockup-blog/blob/master/index.qmd#L27C1-L48C4
# who adapted from Danielle Navarro: https://blog.djnavarro.net/porting-to-quarto/#netlify-redirects
# obtain list of slides
slides <-
list.dirs(
path = c(here::here()),
full.names = FALSE,
recursive = FALSE
) |>
tibble::as_tibble_col(column_name = "folder") |>
dplyr::filter(stringr::str_starts(folder, pattern = "[:digit:]"))
# extract slugs and create redirects
slides <-
slides |>
dplyr::mutate(
# extract the year-slugs
slugs = stringr::str_remove(folder, "(?!\\d{4}-)\\d{2}-\\d{2}-(?!\\d)"),
# slugs = stringr::str_remove(folder, "\\d{4}-\\d{2}-\\d{2}-(?!\\d)"),
# lines to insert to a netlify _redirect file
redirects = paste0("/", slugs, " ", "/", folder)
)
# extract redirects
redirects <- slides$redirects
# combine with manual redirects
redirects_combined <- c(manual_redirects, redirects)
# write the _redirect file
writeLines(redirects_combined, here::here("_site", "_redirects"))
```