-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathposts.qmd
More file actions
37 lines (31 loc) · 833 Bytes
/
Copy pathposts.qmd
File metadata and controls
37 lines (31 loc) · 833 Bytes
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
---
title: "Blog Posts"
listing:
contents: posts
sort: "date desc"
type: default
categories: true
sort-ui: true
filter-ui: true
feed: true
fields: [date, title, author, image, description, categories, reading-time]
page-layout: full
title-block-banner: true
---
```{r netlify-redirects}
#| echo: false
# set up netlify redirects following these posts:
# Source 1: https://blog.djnavarro.net/posts/2022-04-20_porting-to-quarto/#netlify-redirects
# list names of posts folders
posts <- list.dirs(
path = here::here("posts"),
full.names = FALSE,
recursive = FALSE
)
# extract the slugs
slugs <- gsub("^.*_", "", posts)
# lines to insert to a netlify _redirect file
redirects <- paste0("/", slugs, " ", "/posts/", posts)
# write the _redirect file
writeLines(redirects, here::here("_site", "_redirects"))
```