/hrocket

HRocket is a minimalistic static site generator written in R -- it is meant to be a blogging Geek's best friend!

Primary LanguageCSS

HRocket Blogging for Geeks

HRocket aspires to be a static site generator that's a blogging Geek's best friend.

The name HRocket is a play on the venerable portable typewriter the Hermes Rocket.

Design Notes

  1. We should have a top-level R folder where we organize our R code
  2. We should have a bin folder with has bash scripts that wrap the R code
  3. The user as part of the install instructions will be required to add the bin to the path
  4. The bin folder should have:
    1. bin/hrmk -- this is the make file which will run the build process
    2. bin/hrclean -- this will delete any cache files
  5. HRocket can operates in two different modes:
    1. monolithic-mode (perhaps we can find a better word) -- in this mode the published HTML files are under the same directory structure as the HRocket root folder
    2. separate-mode and this is the preferred mode, where the HTML generation directory is outside the HRocket folder
  6. Charting should be done using Plot.ly and ggplot
  7. HRocket will support code embedding from Bash, C, C++, Java, Python, and R -- later we will add support for Scala, Clojure, and other languages
  8. Each theme will be in a self-contained folder with a unique name
  9. The theme folder will be in a folder called themes
  10. The bootstrap theme will be used to build the first theme

System requirements

Install Git on your local machine (see https://git-scm.com/downloads)
Install R on your local machine (see https://www.r-project.org)
Install "configr" package in R
Install "xml2" package in R
Install "pandoc" on your OS (For ubuntu $ sudo apt-get install pandoc)

How to use on ubuntu

Edit .bashrc using following command
$ sudo gedit /home/your-username/.bashrc

Add following new line at the end of file
export PATH=/home/your-username/hrocket/bin:$PATH

After setting above mentioned, clone hrocket from github using following command at your "/home/your-username/" location
$ git clone https://github.com/armaninspace/hrocket.git

Then on your terminal execute hrocket with following command
$ hrocket.sh build-clean

Embedding images

For embedding images put your images at "src/images" directory
Then in your Rmd files embed image as per images section on following link
https://rmarkdown.rstudio.com/authoring_basics.html

computer.jpg is a sample image embeded in "src/content/pages/about.Rmd"

Embedding videos

For embedding youtube videos paste iframe embed code in Rmd file as follow

<iframe class="youtube-player" type="text/html" src="https://www.youtube.com/embed/EjDwhcZq1z0" allowfullscreen="" height="385" frameborder="0" width="100%"> </iframe>

Blog listing page (Full content or Teaser)

For showing full content or teaser on blog listing page there is an option for setting in "/hrocket/src/content/blogs_list/blogs.Rmd"
teaser: "full" (For full content)
teaser: "half" (For content as teaser)

Blog listing as home page

For setting blog as home page there is an option for setting in "/hrocket/src/content/blogs_list/blogs.Rmd"
bloghome: "false" (Not as home page)
bloghome: "true" (As home page)

XML Sitemap

Hrocket will also create a sitemap.xml at website's root directory which includes all the urls of your static website.

Meta Keywords

In config.toml file you can add meta keywaords as follow.
metaKeywords = "HTML, CSS, XML, XHTML, JavaScript"

Google Analytics Integration

In config.toml file you can add key for google analytics as follow.
googleAnalyticsTrackingId = "UA-232232-34"

Robots.txt

Hrocket will also create a robots.txt which allows or disallows the indexing of site by search engine crawlers. This can be handled by a variable in conf.toml file as follow
robotsAllow = "True" (This will allow indexing of static website by the search engine crawlers)
robotsAllow = "False" (This will disallow indexing of static website by the search engine crawlers)

Path Settings

For resolving relative path issue user can adjust some configuration variables in config.toml as follow

  1. for a domain setup
    publishDir = ""
    logoLink = "/"
    [[mainMenu]]
    name = "Home"
    url = "/"
    [[mainMenu]]
    name = "About"
    url = "/content/pages/about"
    [[mainMenu]]
    name = "Blogs"
    url = "/content/pages/blogs"

  2. for github pages (when user's github page repo is "testhrocket")
    publishDir = "/testhrocket"
    logoLink = "/testhrocket"
    [[mainMenu]]
    name = "Home"
    url = "/testhrocket"
    [[mainMenu]]
    name = "About"
    url = "/testhrocket/content/pages/about"
    [[mainMenu]]
    name = "Blogs"
    url = "/testhrocket/content/pages/blogs"