Skip to content

Commit

Permalink
chore: improve home and about page with links
Browse files Browse the repository at this point in the history
  • Loading branch information
Layalchristine24 committed Oct 18, 2023
1 parent e6a292a commit 9837b8d
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 8 deletions.
16 changes: 16 additions & 0 deletions _freeze/index/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hash": "2c3cc6a744947daa31d2556b03e05fdf",
"result": {
"markdown": "---\ntitle: \"rdiscovery\"\nsubtitle: A blog by Layal Christine Lettry\nlisting:\n contents: posts\n feed: true\n sort: \"date desc\"\n type: default\n categories: true\n sort-ui: false\n filter-ui: false\npage-layout: full\ntitle-block-banner: true\nimage: profile_cat.jpg\n---\n\n::: {.cell}\n\n:::\n\n\n<!-- Mastodon verification -->\n<a rel=\"me\" style=\"display:none\" href=\"https://fosstodon.org/@layal\">Hidden link used to verify my account on fosstodon.org</a> \n<a rel=\"me\" style=\"display:none\" href=\"https://linkedin.com/in/layal-christine-lettry-529b4471/\">Hidden link used to verify my account on LinkedIn</a>\n<a rel=\"me\" style=\"display:none\" href=\"https://twitter.com/LettryL\">Hidden link used to verify my account on Twitter</a> \n<a rel=\"me\" style=\"display:none\" href=\"https://github.com/Layalchristine24\">Hidden link used to verify my account on GitHub</a> \n",
"supporting": [
"index_files"
],
"filters": [
"rmarkdown/pagebreak.lua"
],
"includes": {},
"engineDependencies": {},
"preserve": {},
"postProcess": true
}
}
35 changes: 27 additions & 8 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,37 @@ project:

website:
title: "rdiscovery"
description: "Explore R with Layal Christine Lettry"
navbar:
title: false
background: "#eee"
left:
- href: index.qmd
text: Home
- href: index.xml
text: RSS
right:
- about.qmd
- icon: github
href: https://github.com/Layalchristine24/rdiscovery
- icon: twitter
href: https://twitter.com/LettryL
- icon: linkedin
href: https://linkedin.com/in/layal-christine-lettry-529b4471/
- icon: mastodon
href: https://fosstodon.org/@layal
site-url: "https://rdiscovery.netlify.app"
href: https://github.com/Layalchristine24
- text: Social
menu:
- icon: twitter
href: https://twitter.com/LettryL
- icon: linkedin
href: https://linkedin.com/in/layal-christine-lettry-529b4471/
- icon: mastodon
href: https://fosstodon.org/@layal
- text: Sites
menu:
- href: http://layalchristinelettry.rbind.io/
text: Homepage
- href: https://rdiscovery.netlify.app
text: rdiscovery blog
site-url: https://rdiscovery.netlify.app
repo-url: https://github.com/Layalchristine24/rdiscovery
open-graph: true
search: false

format:
html:
Expand Down
59 changes: 59 additions & 0 deletions index.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "rdiscovery"
subtitle: A blog by Layal Christine Lettry
listing:
contents: posts
feed: true
Expand All @@ -10,4 +11,62 @@ listing:
filter-ui: false
page-layout: full
title-block-banner: true
image: profile_cat.jpg
---

```{r write-redirects}
#| echo: false
# list names of post 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
post_redirects <- paste0("/", slugs, " ", "/posts/", posts)
# function to extract post categories from index.qmd files
get_post_categories <- function(post) {
file <- here::here("posts", post) |> fs::path("index.qmd")
if(!fs::file_exists(file)) {
return(character(0))
}
file |>
readLines() |>
stringr::str_subset("^categories:") |>
stringr::str_extract("\\[.*\\]") |>
stringr::str_remove_all("[\\[\\]]") |>
stringr::str_split(", ") |>
unlist()
}
# extract the categories
categories <- purrr::map(posts, get_post_categories) |>
unlist() |>
unique()
# extract categories in nice form
keys <- categories |>
stringr::str_to_lower() |>
stringr::str_replace_all(" ", "-")
# extract categories in ugly form
values <- categories |>
stringr::str_replace_all(" ", "%20")
# category redirects
category_redirects <- paste0("/category/", keys, " ", "/#category=", values)
# write the _redirect file
writeLines(c(post_redirects, category_redirects), here::here("_site", "_redirects"))
```

<!-- Mastodon verification -->
<a rel="me" style="display:none" href="https://fosstodon.org/@layal">Hidden link used to verify my account on fosstodon.org</a>
<a rel="me" style="display:none" href="https://linkedin.com/in/layal-christine-lettry-529b4471/">Hidden link used to verify my account on LinkedIn</a>
<a rel="me" style="display:none" href="https://twitter.com/LettryL">Hidden link used to verify my account on Twitter</a>
<a rel="me" style="display:none" href="https://github.com/Layalchristine24">Hidden link used to verify my account on GitHub</a>
Binary file added profile_cat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9837b8d

Please sign in to comment.