::init()
renv::status()
renv::install()
renv::status()
renv::snapshot() renv
This is how we built this!
No place like home
This is a test of a personal website for jrfep.
These instructions are in English, but this site has content in multiple languages… I know it is confusing, but this is how I work. If you require clarifications please open an issue or send me a message.
All files are available in a GitHub repository. The mostly-harmless
branch uses Quarto to build the site.
Libraries
To manage and update the version of libraries that we need, I used renv
for some iterations, but it was complex to keep version across machines and different OSs…
When we use renv
we need to run different commands, until all the changes have been synchronised1 :
But if we don’t update the .gitignore file things can get messy.
Render site
With Rmarkdown we could run this (in RStudio) to render site locally:
::render_site() rmarkdown
Or preview one file
::render_site("presentations.Rmd") rmarkdown
With quarto and RStudio we can open the Build tab and select Build Website…
Or we can go to the command line and render the site:
quarto render
Sing All the rowboats in the meantime (optional).
And then launch a preview:
quarto preview
If this work, we can just git add
, git commit
and git push
it to the repo and see the changes!
Alternatives
My other branch uses Jekyll (but I gave up on that some time ago, so do not expect any updates).
I also tried Rmarkdown for some time, might get back to that if this one does not work.
I was tempted to create a multi-lingual site using babelquarto:
install.packages('babelquarto', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))
But it was a short-lived experiment. I think it could work for simple sites, but would require more tweaks to make it work with my current site.
Font Awesome
They work well out of the box with Rmarkdown, but for quarto we need to install an extension.
Switch to the repository folder and checkout the git branch we are working on, and then:
quarto install extension quarto-ext/fontawesome
Now I can use {{< fa smile >}}
in the text and get a , or {{< fa lemon >}}
and get a .
Just in case
Prepare data for some pages
OSF data
::i_am("how2/how-to-site.qmd")
hereif (!require(osfr)) {
install.packages("osfr")
library(osfr)
}<- osf_retrieve_user("me") %>%
lst_osf osf_ls_nodes()
if (!dir.exists(here::here("data")))
dir.create(here::here("data"))
<- here::here("data","OSF-data.rds")
file_name saveRDS(file=file_name, lst_osf)
GitHub data
::i_am("how2/how-to-site.qmd")
hereif (!require(jsonlite)) {
install.packages("jsonlite")
library(jsonlite)
}<- read_json("https://api.github.com/orgs/red-list-ecosystem/repos")
gh_rle_org <- read_json("https://api.github.com/orgs/ces-unsw-edu-au/repos")
gh_ces_org <- read_json("https://api.github.com/users/jrfep/repos")
gh_jrfep # https://api.github.com/search/repositories?q=user:jrfep&fork:false
# for each repo query the languages_url and summarise the lines of code for each language
<- here::here("data","GitHub-data.rda")
file_name save(file=file_name, gh_rle_org, gh_ces_org, gh_jrfep)
Flexdashboard and iNaturalist
I use to have a dashboard here, but it works better with Rmarkdown than with quarto. SO I moved it to another site/repo.
There might be some alternatives in quarto for this, but haven’t tested them yet.
That OLD dashboard was inspired by this example: https://github.com/gonzalobravoargentina/inat_flexdashboard_ARG
To get the data I first install the rinat
package:
::i_am("README.Rmd")
hereif (!require(rinat)) {
install.packages("rinat")
library(rinat)
}
Then I can download the observations from iNaturalist and save them in a data folder:
# Download observations and save to RDS file
<- get_inat_obs_user("NeoMapas",maxresults = 5000)
user_obs if (!dir.exists(here::here("data")))
dir.create(here::here("data"))
<- here::here("data","iNaturalist-obs-NeoMapas.rds")
file_name saveRDS(file=file_name, user_obs)
To get the logo
With wget
and ImageMagick, it is easy to download and resize in the terminal (bash
) with two lines of code:
##mkdir
wget https://neomapas.github.io/assets/images/logo_NeoMapas_p.gif
magick logo_NeoMapas_p.gif -resize 100x148 resize_logo.gif
Footnotes
Yes, I use this weird spelling…↩︎