Git Product home page Git Product logo

blogdown's Introduction

blogdown

Build Status

A open-source (GPL-3) R package to generate static websites based on R Markdown and Hugo. You can install the package via:

devtools::install_github('rstudio/blogdown')

If you are not familiar with Hugo or the PATH variable, or do not want to read the Hugo installation instructions, you may use the helper function blogdown::install_hugo() to install Hugo.

Once you have installed Hugo, you may create a new site via blogdown::new_site() under an empty directory. It will create a skeleton site, download a Hugo theme from Github, add some sample content, launch a web browser and you will see the new site. The sample blog post hello-world.Rmd should be opened automatically, and you can edit it. The website will be automatically rebuilt and the page will be refreshed after you save the file.

If you use RStudio, you can create a new RStudio project for your website, and generate the new site in the project (the new project will contain a *.Rproj file but that is fine).

The function blogdown::serve_site() may be the most frequently used function in this package. It builds the website, loads it into your web browser, and automatically refreshes the browser when you update the Markdown or R Markdown files. Do no use the command line hugo server to build or serve the site. It only understands plain Markdown files, and cannot build R Markdown. If you do not want serve_site() to block your R session, you can set the option options(servr.daemon = TRUE) first.

You may not be satisfied with the default site created from new_site(). There are two things you may want to do after your first successful experiment with blogdown:

  1. Pick a Hugo theme that you like from http://themes.gohugo.io. All you need is its Github user and repository name. For example, if you like the Ghostwriter theme, you can install it via blogdown::install_theme('jbub/ghostwriter') (other themes possibly of interest: simple-a, hugo-academic, hugo-future-imperfect, hugo-tranquilpeak-theme, ...).
  2. Add more content (pages or posts), or migrate your existing website.

The full documentation of this package is still under development. If you do not want to wait, you can read the Hugo documentation, which can be a little overwhelming if you have no experience with static site generators. Note although Hugo supports TOML, YAML, and JSON in the front matter of Markdown files, R Markdown only supports YAML, so you have to use YAML in *.Rmd files. Feel free to use other formats in plain Markdown files (*.md).

You are welcome to send us feedback using Github issues or ask questions on StackOverflow with the blogdown tag. Please note this package is still in a very early beta stage.

blogdown's People

Contributors

yihui avatar

Watchers

James Cloos avatar Nick Strayer avatar  avatar

Forkers

anqizhaoaz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.