_environment.required
FLICKR_API_KEY=
José R. Ferrer-Paris
May 17, 2024
This is the typical Hello World!
post in my new and wonderful blog. Welcome!
So this is basically here to test if the whole thing works.
To get started I first installed quarto.1
Then, once I decided how to name my blog, I ran:
Then I started to prepare the content and structure of my initial posts, modified the text in the qmd
files and the configuration in the _quarto.yml
and ran
I started to keep track of changes with git:2
I switch between VS-code, Rstudio and the terminal to organise my files, and kept working on this until I got something I wanted to preview:
Here some random notes about the process
For some reason I though these would fontsawesome icons, but the help prompt in VS-code pointed out:
Name of bootstrap icon (e.g. github, twitter, share). See https://icons.getbootstrap.com/ for a list of available icons
Also, it turns out we can add emojis to the text of a post using this in the front-matter of the file:
This is a handy demonstration of all emojis: https://gist.github.com/rxaviers/7360908
The posts directory has a _metadata.yml
file with the freeze
option activated by default.
_site
folderIn the quarto documentation they recommend to add it to the .gitignore
file, so as to keep the raw content and code in version control, but the output served in a different workflow (either with quarto.pub or GitHub actions).
There are certain environment variables that need to be specified in order to render the posts in this blog. I created an _environment.required
file with the list of required variables and empty values.
For local development, I defined these variables in the _environment.local
file and ignore this file in version control by adding /_*.local
in .gitignore
.
Some code is running with RStudio / VScode and R , some code with Python and Jupyter.
For python, we created a virtual environment in the project directory.
Then we activate the environment
Then we update pip, install other packages with:
pip install --upgrade pip
pip install jupyterlab
pip install numpy matplotlib spyder owslib
pip install geopandas rasterio rasterstats affine osmnx
pip install earthpy
pip install h3pandas
pip install pyinaturalist
To make this environment reproducible, we create a requirements.txt using pip
Then we can reproduce this environment on another machine by creating an empty environment, activating it, and then:
In order to use some external photos in my blog posts I create a table with the basic information from my photo collection in Flickr. I need to add this code-chunk in my post to locate and load the file:
And these lines to create the markdown code to include in my blog post (notice the results
option):
```{r}
#| results: asis
selected_photo <- dplyr::slice(photos, grep("Del-etreando", title))
photo_md <- sprintf(
"![**%s** by %s@flickr](%s){.preview-image .lightbox}",
selected_photo$title,
selected_photo$ownername,
selected_photo$url_m
)
cat(photo_md)
```
I add the class preview-image
to select which foto will appear in the listing page of posts.
Since I also have a bunch of observations in iNaturalist, I can use those as another source of images to illustrate my blog. I need to add this code-chunk in my post to locate and load the file:
And these lines to create the markdown code to include in my blog post (notice the results
option):
```{r}
#| results: asis
selected_photo <- user_obs |> dplyr::slice_sample(n=1)
photo_md <- sprintf(
"![*%s* observed in %s by [%s@iNaturalist](%s)](%s){height=150 group=\"my-gallery\"}",
selected_photo$species_guess,
selected_photo$place_guess,
selected_photo$user_login,
selected_photo$url,
selected_photo$image_url
)
cat(photo_md)
```
I keep some random images in the thesaurus
folder and use imagemagick
to make copies for my blog post. For example:
I created an empty repo in GitHub and then added it as a remote:
Now the source code and git history is available at: https://github.com/jrfep/spatial-one
I am preparing this site for my quarto.pub profile. From the directory where this project is located, I executed the quarto publish command for Quarto Pub:
And then followed instructions at quarto.org.
Easy!
Comments through Giscus
How to get comments powered by GitHub Discussions and the giscus app?