Skip to content

Commit 2c3aea5

Browse files
committed
don't actually run the R code, since it's a template
1 parent d33e491 commit 2c3aea5

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

posts/new_blog_who_dis/index.qmd

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@ On the other hand, my Jekyll blog directory looks like has markdown files under
6060

6161
So the first task is to convert all my markdown blog posts into their own sub-folder under a *posts* directory. I would also like to grab any and all meta data out of the posts while doing so.
6262

63-
```{r}
64-
#| message: false
65-
#| warning: false
63+
```r
6664
library(tidyverse)
6765

6866
# md posts filenames & location
69-
posts <- list.files("../../../sites/eringrand.github.io.raw/_posts/", full.names = TRUE)
67+
posts <- list.files("eringrand.github.io.raw/_posts/", full.names = TRUE)
7068

7169
posts_raw <- data.frame(post_loc = posts, # full filepath
7270
post_name = basename(posts) # just the file name
@@ -92,19 +90,14 @@ posts_info <- posts_raw |>
9290
str_remove_all("[[:punct:]]") |>
9391
str_trim() |>
9492
str_c(collapse = ", "),
95-
) |>
96-
select(post, title, date, categories, author)
97-
```
98-
99-
```{r}
100-
tail(posts_info)
93+
)
10194
```
10295

10396
I then did a bunch of text cleaning of my tags/categories, but honestly I ended up rewriting them manually anyway, so I'm going to ignore that code for now.
10497

10598
With all the post information, and most of the meta data, now I could write the new post structure and files.
10699

107-
```{r}
100+
```r
108101
fill_between <- function(x) {
109102
x_log = str_detect(x, "---")
110103

@@ -137,13 +130,9 @@ posts_all <- posts_info |>
137130
select(dir_title, new_post_txt)
138131
```
139132

140-
```{r}
141-
head(posts_all)
142-
```
143-
144133
Now with the posts written in the way I wanted them, I just had to create the new sub-folders, and write the posts out into individual index.qmd files.
145134

146-
``` r
135+
```r
147136
walk(pull(posts_all, dir_title), ~dir.create(glue::glue("posts/{.x}")))
148137
walk2(pull(posts_all, dir_title), pull(posts_all, new_post_txt), ~writeLines(.y, glue::glue("posts/{.x}/index.qmd")))
149138
```

0 commit comments

Comments
 (0)