Generate bibliographic metadata for your (blogdown / Hugo ) website using COinS (Context Object in Spans).
COinS is the abbreviation of "Context Objects in Spans". It refers to a microformat standard to embed bibliographic metadata as HTML. A COinS string includes as HTML code all the information necessary to cite a publication correctly. It works for every type of publication (books, papers, web pages).
The main advantages of COinS is that it can generate citations. COinS embedded in your HTML pages helps your blog readers or website visitors to cite your posts and pages correctly.
With coinsR
you can create COinS metadata programmatically either for one webpage or recursively for all files of a directory.
coins_all()
-- Applies COinS recursively at the end of all files under the content
directory.coins_all('content/post')
-- Applies COinS recursively at the end of all files under the content/post
. directory.coins_this('content//docs/learned.md')
-- Applies a COinS at the end of the file content//docs/learned.md
.COINSR
from the RStudio Addins -- Adds a COinS at the end of the file currently open RStudio.remotes::install_github('petzi53/coinsR', build_vignettes = TRUE)
I am trying to prepare coinsR
as an R packages distributed via the CRAN repository. But as I am still not very experienced in R programming I am not sure if I will succeed.
coinsR
and limitationsBefore going into the detail of this package, I will summarize what use cases this package support and where it has its limitation.
The package requires:
I am planning for a future version to loosen the last two limitations and allow it for config.yaml and TOML front matter (but not for .json).
coinsR
There are just two functions:
coins_all(dir = 'content')
: dir
is a path to a directory to pages with YAML front matter. The default value is 'content,' e.g., add COinS to all files of the blogdown website.coins_this('path-to-filename')
: You can either use this command from the console with a path to a file name or to apply COINS
from the RStudio Addins to create a COinS at the end of the currently open file. You would get success messages for all files where coinsR
has added a COinS string at the end of the data.
Success! COinS added at the end of 'docs/learned.md'.
For a correct citation with COinS the following data are mandatory:
All these missing data will stop execution of coinsR
program with the following error messages.
Other missing data produce a warning, but COinS are added to the end of the file anyway:
COinS does not produce an error if the file name is '_index.md. It skips all index files.
There is another possibility to prevent adding COinS at the end of the file. coinsR
skips all files, when they have the directive no_coins: true
in the YAML front matter.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.