Samatha is an R package for quickly building Github-ready static sites in R. It contains a simple, functional-style DSL for rendering HTML, an engine for compilation of static websites as you build them and a development web-server for viewing your sites of line before you deploy.
This project is still in active development. Feel free to contact me with any issues/bugs/suggestions
The Static site engine uses the Samatha DSL to build layout templates which it then combines with content to generate individual pages. templates are written as a nested R expression, with no need for extenal templating systems. There are two ways to build pages:
The Samatha engine samatha()
now functions as expected. It compiles your site and then updates in real time according to the following rules:
Extra features:
%
. All words on the rest of the line are coerced to tags and included in the RSS file.rss.category.feeds
variable in the config.R
file can be used to add extra rss feeds for specific categories. For example, R Bloggers require that all posts sent to them only concern R
. You can therefore set rss.category.feeds = c(R)
and Samatha will produce another rss feed just with your R content (matching tags for "R") and put it in site/site/tags/R.xml
. You can then send this link to Rbloggers and be feee to publish on other subjects, knowing only R content will go to Rbloggers.Sites are created with the following structure:
My personal blog was built using Samatha, twitter bootstrap and Github pages. I used the Readable theme. See here for the file structure of a Samatha site.
This gist Gives code to quickly setting up an example site.
You should be able to install the current version of Samatha with devtools:
# check install_github()
require(devtools)
install_github("samatha", "DASpringate")
library(samatha)
site <- "/dir1/dir2/dirSite"
skeleton(site)
setup_example_site(site)
samatha(site, rss = FALSE, initial = TRUE)
samatha(site, rss = FALSE, initial = TRUE)
run.server(site) # open browser to localhost:8000 to see the site
I'm still working on it!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.