Giter Site home page Giter Site logo

rstudio / blogdown Goto Github PK

View Code? Open in Web Editor NEW
1.7K 72.0 334.0 3.13 MB

Create Blogs and Websites with R Markdown

Home Page: https://pkgs.rstudio.com/blogdown/

R 98.96% HTML 0.65% JavaScript 0.38%
hugo blogdown rstudio rmarkdown r blog-engine website-generation

blogdown's Introduction

blogdown

R-CMD-check CRAN status Codecov test coverage

The goal of the blogdown package is to provide a powerful and customizable website output format for R Markdown. Use dynamic R Markdown documents to build webpages featuring:

  • R code (or other programming languages that knitr supports),

  • automatically rendered output such as graphics, tables, analysis results, and HTML widgets, and

  • technical writing elements such as citations, footnotes, and LaTeX math, enabled by the bookdown package.

By default, blogdown uses Hugo, a popular open-source static website generator, which provides a fast and flexible way to build your site content to be shared online. Other website generators like Jekyll and Hexo are also supported.

A useful feature of blogdown sites, compared to other R Markdown-based websites, is that you may organize your website content (including R Markdown files) within subdirectories. This makes blogdown a good solution not just for blogging or sites about R — it can also be used to create general-purpose websites to communicate about data science, statistics, data visualization, programming, or education.

Book

blogdown: Creating Websites with R Markdown

Installation

You can install the package via CRAN as follows:

install.packages('blogdown')

If you want to use the development version of the blogdown package, you can install the package from GitHub via the remotes package:

remotes::install_github('rstudio/blogdown')

Usage

You may create a new site via the function 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 from the menu File -> New Project -> New Directory -> Website using blogdown.

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 not use the command line hugo server to build or serve the site. It only understands plain Markdown files, and cannot build R Markdown.

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 https://themes.gohugo.io. All you need is its Github user and repository name, to be passed to the theme argument of new_site().
  2. Add more content (pages or posts), or migrate your existing website.

Getting help

There are two main places to get help:

  1. The RStudio community is a friendly place to ask any questions about blogdown. Be sure to use the blogdown tag.

  2. Stack Overflow is a great source of answers to common blogdown questions. Use the tags [r][blogdown] if you ask a question.

Code of Conduct

Please note that the blogdown project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

blogdown's People

Contributors

apreshill avatar asimumba avatar barkleybg avatar bijaelo avatar cderv avatar gadenbuie avatar kevinushey avatar lcolladotor avatar m4xl1n avatar maelle avatar nanxstats avatar njbart avatar njtierney avatar novica avatar pablobernabeu avatar pat-s avatar peterfoley avatar proquestionasker avatar rgaiacs avatar robinlovelace avatar rorynolan avatar rpodcast avatar rsangole avatar salim-b avatar shrektan avatar tcgriffith avatar thanosgatos avatar tteo avatar yihui avatar yutannihilation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blogdown's Issues

Problem when chunk return 2 plots

If you add a chunk that results in 2 plots, like this

```{r test, fig.show='hold', out.width="50%"}
library(ggplot2)
ggplot(mtcars) + geom_point(aes(x = mpg, y = disp))
ggplot(mtcars) + geom_point(aes(x = mpg, y = disp))
```

You will get this warning when serving the site:

Warning messages:
1: In file.create(to[okay]) :
  cannot create file './post/hello-world/figures', reason 'Is a directory'
2: In file.create(to[okay]) :
  cannot create file './post/hello-world/figures', reason 'Is a directory'

Then both images are not displayed. When you re-serve the site it works, but if you erase the public directory it will happen again. This happens directly when using blogdown::new_site() and you add the chunk to the sample post.

Links to figures are not correct in RSS

When blogdown processes the .Rmd files it creates .html files in the blogdown directory with <img> tags such as

<img src="#####../content/blog/2017/01/13/mapping-users/mapping-users_files/figure-html/unnamed-chunk-2-1.png" width="672" style="display: block; margin: auto;" />

In the published .html the URLs end up as relative links, e.g. src="figures/unnamed-chunk-2-1.png which works fine. However the temporary links remain in the RSS generated by Hugo, so the images aren't found in the .xml file.

For now we're getting round this by post-processing the .xml file.

figures not being generated

I've recently come across blowdown after reading and searching for how to include htmlwidgets with jekyll+knitr to no avail.

I've been able to do a basic build using the instructions in the Readme.MD file, however I am struggling to understand why some charts don't end up with a figure being placed in the ../public/... folder.

The chart gets created in the ../blogdown/post/mypost_files/figure-html/ folder however they don't end up in at all in the ../public location.

I've got a repo here that hopefully demonstrates the issue at hand.

Let me know if you need any sessionInfo

unknown flag: --force when trying to run new_site()

Hi! I am trying to set up a webpage using Blogdown, Hugo and GitHub, following @ProQuestionAsker's blog post, but I get an error when I try to run the function new_site().

I am trying to run the function in an empty directory (apart from the .Rproj, .gitignore, and .Rhistory files). This is what I've run:

> devtools::install_github("rstudio/blogdown")
> library(blogdown)
> install_hugo()

So far, so good.
And then, I get the following error:

> new_site()
unknown flag: --force

Usage: 
  hugo new site [path] [flags]
Flags:
  -f, --format="toml": config & frontmatter format

Global Flags:
  -b, --baseUrl="": hostname (and path) to the root eg. http://spf13.com/
  -D, --buildDrafts=false: include content marked as draft
  -F, --buildFuture=false: include content with datePublished in the future
      --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
      --config="": config file (default is path/config.yaml|json|toml)
  -d, --destination="": filesystem path to write files to
      --disableRSS=false: Do not build RSS files
      --disableSitemap=false: Do not build Sitemap file
      --editor="": edit new content with this editor, if provided
  -h, --help=false: help for site
      --ignoreCache=false: Ignores the cache directory for reading but still writes to it
      --log=false: Enable Logging
      --logFile="": Log File path (if set, logging enabled automatically)
      --pluralizeListTitles=true: Pluralize titles in lists using inflect
  -s, --source="": filesystem path to read files relative from
      --stepAnalysis=false: display memory and timing of different steps of the program
  -t, --theme="": theme to use (located in /themes/THEMENAME/)
      --uglyUrls=false: if true, use /filename.html instead of /filename/
  -v, --verbose=false: verbose output
      --verboseLog=false: verbose logging

screen shot 2017-01-02 at 21 01 42

These are my settings:

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Mavericks 10.9.5
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] blogdown_0.0.9

loaded via a namespace (and not attached):
[1] httr_1.2.1      R6_2.2.0        tools_3.3.2     withr_1.0.1    
[5] curl_2.3        memoise_1.0.0   digest_0.6.10   devtools_1.11.1

I don't really understand the error, or how to solve it.
What am I missing?
Any help will be highly appreciated!

New pages not getting created in public folder

I'm creating a new RMarkdown file, eplBook,Rmd in the content/post folder

> serve_site()

Error: Error copying static files to C:\Users\Andrew\Documents\R\mainWebSite\public: open C:\Users\Andrew\Documents\R\mainWebSite\public\img\Thumbs.db: Access is denied.

an html file is created in content/post

content

but there is no related directory in public/post

public

Error installing hugo

I get the following error when executing the install_hugo function:

> blogdown::install_hugo()
error: unknown option `sort=-version:refname'
usage: git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]
   or: git tag -d <tagname>...
   or: git tag -l [-n[<num>]] [--contains <commit>] [--points-at <object>] 
		[<pattern>...]
   or: git tag -v <tagname>...

    -l, --list            list tag names
    -n[<n>]               print <n> lines of each tag message
    -d, --delete          delete tags
    -v, --verify          verify tags

Tag creation options
    -a, --annotate        annotated tag, needs a message
    -m, --message <message>
                          tag message
    -F, --file <file>     read message from file
    -s, --sign            annotated and GPG-signed tag
    --cleanup <mode>      how to strip spaces and #comments from message
    -u, --local-user <key id>
                          use another key to sign the tag
    -f, --force           replace the tag if exists
    --column[=<style>]    show tag list in columns

Tag listing options
    --contains <commit>   print only tags that contain the commit
    --points-at <object>  print only tags of the object

Note that I am on OS X Mavericks on this machine which could have a version of git that's too old:

> system("git --version")
git version 1.9.5 (Apple Git-50.3)

how to downscale, compress non-knitr images

This isn't really a feature request, just wanted to document a way I was going about the problem.

Maybe @yihui will find this worthwhile to pursue as a blogdown feature, I'll be happy to try and develop this into a PR then, though I'm not sure where in the stack this "belongs", and/or whether it's a wise idea to do this in R at all.


In more general use-cases of blogdown(), involving a lot of non-knitr assets (knitr can deal with resolution and compression itself), people (like myself) might want to programmatically reduce the filesize of assets in static/img.

Hugo itself doesn't (yet?) offer this kind of thing, and there is specialised software out there that a lot of people seem to recommend, such as hugulp.

I was looking for a simple solution that would work just with R and on travis (for deployment), without any additional dependencies and stuff I don't know how to use.

So I hacked together a little script to do this exclusively in R, to be found here.

If you add this to some compression.R at your project root:

# resize and compress images ===
library(magick)
library(pbapply)  # just so we have a progress bar, because this thing takes a while

resize_n_compress <- function(file_in, file_out, xmax = 1920, quality = 0.7, cutoff = 100000) {
  # xmax <- 1920  # y pixel max
  # quality <- 0.7  # passed on to jpeg::writeJPEG()
  # cutoff <- 100000  # files smaller than this will not be touched
  # file_out <- "test.jpg"
  if (file.size(file_in) < cutoff) {  # in this case, just copy file
    if (!(file_in == file_out)) {
      file.copy(from = file_in, to = file_out, overwrite = TRUE)
    }
  } else {# if larger than cutoff
    # magick workflow
    image_raw <- image_read(path = file_in)
    if (image_info(image_raw)["width"] > xmax) {  # only resize if smaller
      image_resized <- image_scale(image = image_raw, geometry = as.character(xmax))
    } else {
      image_resized <- image_raw
    }
    image_write(image = image_resized, path = file_out, format = "jpeg", quality = quality)
  }
}

find_large_files <- function(dir_original, dir_scaled) {
  # function to find all files which actually NEED to be rescaled
  # otherwise we would end up rescaling files all the time, which is pretty bad
  # dir_original <- "static/img/"
  # dir_scaled <- "public/img/"
  all_original <- list.files(path = dir_original, pattern = "\\.jpg$", all.files = FALSE, no.. = TRUE, full.names = FALSE, recursive = TRUE)
  all_scaled <- list.files(path = dir_scaled, pattern = "\\.jpg$", all.files = FALSE, no.. = TRUE, full.names = FALSE, recursive = TRUE)
  equal_sizes <- rank(x = file.size(paste0(dir_original, all_original))) == rank(file.size(paste0(dir_scaled, all_scaled[all_scaled %in% all_original])))
  large_files <- all_original[equal_sizes]
 return(large_files)
}

reduce_large_files <- function(dir_original, dir_scaled, xmax = 1920, quality = 0.7, cutoff = 100000) {
  large_files <- find_large_files(dir_original = dir_original, dir_scaled = dir_scaled)
  pbapply::pboptions(type = "txt")  # other output will not go to terminal
  pblapply(X = large_files, FUN = function(x) {
    resize_n_compress(file_in = paste0(dir_original, x), file_out = paste0(dir_scaled, x), quality = quality, xmax = xmax, cutoff = cutoff)
  })
}

# now let's do this
invisible(reduce_large_files(dir_original = "static/img/", dir_scaled = "public/img/", quality = 0.5))

and then, for Travis fun, amend your _build.sh like so:

#!/bin/sh

Rscript -e "blogdown::install_hugo()"
Rscript -e "blogdown::build_site()"
Rscript compression.R

Travis will then compress and rescale all *.jpg files bigger than cutoff as specified.

For now, only the x dim can be specified, and the y will be scaled accordingly, to retain the aspect ratio.

Ps.: one important addition would be to avoid re-scaling/compressing knitr assets. That would be stupid.

Figures generated by Rmd not found when publishdir != "public"

Following advice here we're using separate source and publication repos. Unfortunately when publishdir was set to the publication repo (i.e. publishdir = "../forwards.github.io") the figures created when compiling the .Rmd files were not copied to the correct place, so the links in the final .html files didn't work.

We're currently getting around this by publishing to the "public" directory, then copying over when we're ready to publish (see our hack).

cache hugo dependency

I'm a big fan of making projects self-contained, and I particularly for scientific projects, I worry about whether I will be able to change (something small) a couple of years down the road, without going into dependency hell.

packrat does a nice job of this, and so does bookdown, which, I understand, actually ships with all of its dependencies (for example, all of the gitbook.io stuff).

As far as I understand, this also extends to blogdown, with the exception of Hugo itself via blogdown::install_hugo().

I worry that this might make it hard to reproduce and/or fix small things in projects years down the road, when hugo may have changed quite a lot.

I've been burnt by this with regard to Jekyll, which kept changing (improving) over the years, but has made it hard to edit old projects.

Is there any chance to somehow cache the hugo dependency with blogdown or even via packrat?

Pushing to GitHub pages

Hey!

I have just tried out the package and it works great! While serve_site() builds the site, is there by chance a command to push the built site via RStudio or do I still have to resort to git for that?

themes not working in production (s3 site)

First... very thankful for blogdown! This has been a bit of a headscratcher as I'm new to most of this stuff. I've got an S3 site setup at www.willumz.com. I've used build_site() to generate a public directory and then pushed it over to the s3 bucket. Everything seems to be working correctly (no changes to the toml file) except for themes. Themes work well on the local server and the css files seem to be in the right place relative to the root directory.

I'm still looking into the cause but thought I'd put up an issue just in case I'm missing something obvious (or there is actually a bug).

new project followed by:

library(blogdown)
new_site()
system("s3cmd sync public/ s3://mybucket")

results:
http://www.willumz.com/

???

Note install_hugo

>  blogdown::new_site()
 Show Traceback
 
 Rerun with Debug
 Error in find_exec("hugo", "Hugo") : 
  hugo not found. If it is installed, please make sure the executable can be found via the PATH variable. 

Should mention blogdown::install_hugo()

HTML Widgets not displaying

On one of my pages, I've used blogdown to generate an HTML file with a built in highcharter graph, but the graph doesn't show (it just leaves a white space where it should be).
screen shot 2016-12-15 at 8 13 56 pm

If I inspect the page, it looks like the page recognizes that an html widget should be there:
screen shot 2016-12-15 at 8 14 14 pm

And the needed .js files are also in the same repository, so it should have all the information it needs to display.
screen shot 2016-12-15 at 8 14 39 pm

Trying new default lithium and hitting errors right away

As recommended have switched to the default lithium theme within a new R project

library(blogdown)
new_site()

Appears fine.

I add one word to the provided .Rmd file

serve_site()

result
mtsissue

sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] blogdown_0.0.11

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8     bookdown_0.3    digest_0.6.11   rprojroot_1.1   mime_0.5        backports_1.0.4 magrittr_1.5   
 [8] evaluate_0.10   stringi_1.1.2   rstudioapi_0.6  rmarkdown_1.3   tools_3.3.1     servr_0.5       stringr_1.1.0  
[15] httpuv_1.3.3    htmltools_0.3.5 knitr_1.15.1 

Rendering with full paths

Since I'm deploying gh-pages in a repo (not org.github.io repo), I'm not able to use relative paths. So I'm using hugo -s . to build the site.

By doing this, all assets like javascripts and css are linked with full path: src="https://curso-r.github.io/verao2017/javascripts/application.js" for example.

This doesn't happen with images in Rmd files, they have a strange link: src="#####../content/hello-world/index_files/figure-html/pie-1.png"

How can I make blogdown render the html with baseurl param before the path to image instead of #####../content?

This is my repo:
https://github.com/curso-r/verao2017

And I'm using wercker to deploy the public folder to github pages.

Thanks in advance!

new_site() and used directories

I think you need to make clear that new_site() will work when run in a non-empty directory, it just doesn't do what you want :(

Page renders successfully using rmarkdown::render but not blogdown::build_site

I'm having a strange issue where the same file is rendering successfully using rmarkdown::render but not blogdown::build_site. The problem function is the getFrame function from the EBImage package from @aoles . I think it could be something to do with the environment the rendering is happening with, or perhaps it's something peculiar to the EBImage package but I thought I'd raise it as an issue here. What's the best way to debug failing code in Rmd documents being rendered by blogdown?

example code

Error message at build time:

Quitting from lines 24-25 (test_image.Rmd) 
Error in eval(expr, envir, enclos) : could not find function "slot"
Calls: local ... eval -> eval -> [ -> [ -> eval.parent -> eval -> eval
Execution halted

But fab package, I've been wanting to blog using Rmd for a while and this looks like a really easy way to do it!

Including image using blogdown

I am struggling to include the image using blogdown. Specifically where should I store my image ?
I am using the following structure but the image is not displayed. I have saved the image on the post folder.

* This is the image : 
![My picture](pic1.PNG)

The output looks like:
image

Can anyone tell me where should I store the image and the proper syntax to use?

Question about config function

Hi, I've run into issues changing the output directory (to docs to allow easy posting on github pages). When you try and switch it messes up figures and just generally doesnt work. I've attempted to track it down but was wondering if some clarification could be provided about this line in R/utils.R 117-119

publish_dir = function(config = load_config()) {
  get_config('publishdir', 'public', config)
}

The get_config() function is rather confusing to me, is 'public' hardcoded in this case?

htmlWidgets show up on individual pages, but not on main page

I have a Rmd file in /blog/public/content/post/routing.Rmd and it includes two leaflet charts. After building, these show up just fine when I browse to /blog/post/routing/, but when that post is the newest one and displayed on the main page, /blog/, the leaflet charts are missing. Looking in the javascript console, I see errors such as: GET http://localhost/rmarkdown-libs/htmlwidgets-0.8/htmlwidgets.js.

Cool package, by the way, though.

Hugo generated .Summary lacks manual cut-off in .Rmd

While the Hugo-generated .Summary leaves much to be desired in terms of customization, it can be slightly modified in .md documents by adding a <!--more--> tag below content you wish to be included. This tag doesn't seem to work on blogdown-generated .Rmd files, causing the default summary to be the first 70 words of the post (which often includes the table of contents and other materials that aren't appropriate for a summary).

This may be more of a Hugo issue than a blogdown one but it seemed appropriate to at least mention here.

support responsive images via <picture> element

Since we're using a lot of images in R (plots, sometimes quite detailed), and since blogdown might cover some general websites/blogging use cases with lots of non-R images, it might be worthwhile at some point to support this newfangled thing of "responsive" images via the <picture> element.
Specifically, I mean the non-art-direction use cases of this feature, such as downloading an image in a different resolution depending on the DPI and size of the viewport.

I realise this is a bit of a long shot, and probably primarily a HUGO / HUGO themes issue, but I wanted to log this here anyway, to discuss how this might interact with knitr chunk options etc.

Once this does become available in HUGO / HUGO themes, I guess bookdown (or perhaps knitr?) would also have to learn to provide R plots in a variety of resolutions, so that the browser can download the appropriate one based on <picture> viewport size and DPI.

Status 65535

I have successfully installed blog down and when I run the following command:
library(blogdown)
blogdown::new_site()
I get the following error

Warning message:
running command '"C:\Users\smuyengwa\AppData\Roaming/Hugo/hugo.exe" new site "." -f toml' had status 65535

GitLab and htmlwidgets Support?

I have to admit to not actually trying to install this yet, but the README suggests a requirement for a GitHub account. I was wondering if this will work with GitLab, specifically in the first instance gitlab.com too?

I'm really looking forward to seeing how this develops. I've been wanting to move one site from Jekyll to Hugo, and launch another in Hugo, but put it in the later basket without RMarkdown/knitr/RStudio support.

Easy support for htmlwidgets would also be really appreciated. At the moment I have DT and metricsgraphics integrated in my Jekyll site following the process outlined in this blog post.

Inconsistent code highlighting

I've just updated my first blogpost and the code highlighting seems to be looking for js.cpp or in the last block of the page js.cs. I expect I need to update the theme a little bit to use R highlighting, however I find it strange that it is using two different highlighting themes.

Repo is here

Any tips on how to 'force' highlighting to pick up the correct highlight style would be super too.

Issue on activating the theme

Hi Yihui,
Thanks for getting back to my issues. I am having the issue when trying to activate any theme other than lithium theme.

For example, I am using the theme hugo-theme-casper. When I use the serve_site() command, it gives the following error message:

> serve_site()
Started building sites ...
ERROR: 2017/01/30 13:40:45 general.go:236: theme/partials/semantic.html is an incomplete or empty template
ERROR: 2017/01/30 13:40:45 general.go:236: theme/partials/author.html is an incomplete or empty template
Built site for language en:
0 draft content
0 future content
0 expired content
13 regular pages created
6 other pages created
0 non-page files copied
7 paginator pages created
3 tags created
0 categories created
total in 172 ms

Is there anyway to fix this ?

When I use viewer in Rstudio, then all the pages display. However, if I use public folder and try to view the posts, i cannot see any posts. Only thing I can see is the homepage.

install_hugo() installs older version 0.16 - some themes not supported - upgraded to 0.18 to fix

Hello, great package going to migrate my blog to it ASAP.

Just a FYI that others may come across: the hugo version available via blogdown::install_hugo() installed hugo v0.16, yet the latest version is 0.18.1 and that was needed for me to get a theme to work.

The original issue on the theme github here: digitalcraftsman/hugo-icarus-theme#70 (comment)

I fixed via install newer version on OSX and using brew via:

brew unlink hugo
brew update && brew install hugo
hugo env

Is there a particular reason to pin the blogdown::install_hugo() to that version, i.e. could it break something now I've upgraded?

error using blogdown::install_theme()

Hi,
I try to install hugo theme and i have this error:

> blogdown::install_theme('jrutheiser/hugo-lithium-theme')
> Error in setwd(dir) : cannot change working directory

I use empty directory and Project directory but I have the same error.
Thank

Error with serve_site()

New problem

> serve_site()
Error in find_config() : 
  Cannot find the configuration file config.yaml or config.toml of the website
> 

servesiteissue

I recently updated to blogdown v 0.0.18

Switch themes efficiently in bookdown

Hi,

Is there an easy way to switch between themes ? I only found install_theme function in blogdown package. I have few themes that are downloaded in my machine. Only way i can make them work is by using install_theme. Since they are already downloaded on the machine, is there any way to use them ?

image

install_theme() should prefer curl

install_theme() fails when verifying github's certificate. This is probably a MacOS-specific issue related to the wget port. Could be resolved by changing how download.file() method is selected in download2() - to prefer curl over wget.

> install_theme('jbub/ghostwriter')
--2016-11-20 12:10:59--  https://github.com/jbub/ghostwriter/archive/master.zip
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
ERROR: cannot verify github.com's certificate, issued by ‘CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
  Unable to locally verify the issuer's authority.
To connect to github.com insecurely, use `--no-check-certificate'.
Do not forget to change the 'theme' option in 'config.yaml' to "ghostwriter"
Warning messages:
1: In download.file(url, method = method, ...) :
  download had nonzero exit status
2: In utils::unzip(zipfile) : error 1 in extracting from zip file

How to use Latex expressions in blogdown?

If I use

$$SE = \sqrt{\frac{s_{1}^{2}}{n_{1}}+\frac{s_{2}^{2}}{n_{2}}}$$

in the document the resulting HTML page shows this result

[SE = \sqrt{\frac{s_{1}^{2}}{n_{1}}+\frac{s_{2}^{2}}{n_{2}}}]

Can anybody help out?

Automatic deployment using Travis CI

@yihui Referring to your comment: http://disq.us/p/1eyc771

Is there already a setup for Travis CI to use automatic deployment? Your travis.yml does not seem to do deployment right now?
ATM I´m using wercker as this is suggested by Hugo. While this works using a "two repo" solution with Github pages, the deploy script does not support .Rmd files but only .md files.

Wercker.yml

box: golang:latest

build:
  steps:
    - script:
        name: initialize and update git submodules
        code: |
            git submodule init
            git submodule update --remote --recursive
    - arjen/hugo-build:
        version: "HEAD"
        theme: academic

deploy:
  steps:
    - install-packages:
            packages: git
    - leipert/git-push:
            gh_oauth: $GIT_TOKEN
            repo: pat-s/pat-s.github.io
            branch: master
            basedir: public

Support for widgetframe

Similar to rstudio/bookdown#271 I need a way to move the child widget HTML and lib files over to the bookdown directory and subsequently to public directory under the proper sub directory.

Current behavior is the child html is copied under directory 'public/1/01/01/index.html' and widget_libs folder is copied under `public/post/. Both these behaviors are not correct.

The child widget and its widget_libs directory should be copied over to where the parent HTML is.

Request. Is it possible to allow a rebuild using the hugo command ?

Hi,

My images break when running hugo from the commandline, because the html-file in the contents directory is used without alterations:

<img src="#####../content/post/R_files/figure-html/pressure-1.png" width="672" />
Using blogdown::build command the image is correct:

<p><img src="figures/pressure-1.png" width="672" /></p>

It would be practical if the hugo command could be used when non-R pages are written or updated.

blogwdown:::parse_toml() doesn't seem to be able to handle hugo-academic's config.toml file

Hi Yihui,

Thank you again for adding another contribution to R, you are relentless!

My #rstudioconf slides: 1) Advanced Rmd https://t.co/etQlXVYgYI 2) blogdown https://t.co/huitnIPx8Q 3) Extending Rmd https://t.co/j1zVBU86CI

— Yihui Xie (@xieyihui) January 15, 2017

It took me a bit to get the Academic framework (not a theme) to get going but I love it (see details at HugoBlox/hugo-blox-builder#93). After getting everything setup, it was time to write a new R blog post, which I tried to do with blogdown (with the current latest commit).

My setup is like this:

While using R at the hugoblog directory, I used blogdown::new_post() to get a Rmd file. Worked well. However, blogdown::serve_site() lead the the same error message I initially saw when using hugo-academic HugoBlox/hugo-blox-builder#93. That is:

ERROR: 2017/01/19 00:50:57 general.go:236: theme/partials/article_metadata.html is an incomplete or empty template

My best guess is that https://github.com/lcolladotor/hugoblog/blob/master/config.toml is too complicated for

blogdown/R/utils.R

Lines 97 to 112 in 35dd89f

parse_toml = function(f, x = readUTF8(f)) {
z = list()
# strings
r = '^([[:alnum:]]+?)\\s*=\\s*"([^"]*?)"\\s*$'
y = grep(r, x, value = TRUE)
z[gsub(r, '\\1', y)] = as.list(gsub(r, '\\2', y))
# boolean
r = '^([[:alnum:]]+?)\\s*=\\s*(true|false)\\s*$'
y = grep(r, x, value = TRUE)
z[gsub(r, '\\1', y)] = as.list(as.logical(gsub(r, '\\2', y)))
# numbers
r = '^([[:alnum:]]+?)\\s*=\\s*([0-9.]+)\\s*$'
y = grep(r, x, value = TRUE)
z[gsub(r, '\\1', y)] = as.list(as.numeric(gsub(r, '\\2', y)))
z
}
to parse properly.

So instead of blogdown I modified the TextMate code I described at http://lcolladotor.github.io/2013/11/09/new-Fellgernon-Bit-setup-in-Github/#.WIIMlbYrJoO to write my first blog post with hugo. See lcolladotor/markdown-redcarpet.tmbundle@f043c05 for details.

You'll notice that I'm using knitr::render_markdown() and that it actually works with the smilies. I didn't try using hugo shortcodes yet #40 but it might work.

Best,
Leo

Support for shiny runtime?

I'm curious whether there'll be support for shiny apps. I tried copying the public directory to a shiny server. The blog sorta rendered but relative links seemed broken and couldn't run a basic shiny app.

Just curious. I've been starving for this and am already migrating away from Jekyll. Thanks!

serve_post() possibility?

Unless I'm missing something, the only way to view output of an individual post is via serve_site() which previews the whole site

This could get a bit time-wasting as the blog expands and only one post is being worked on

Responsive css for htmlwidgets

Hello!

First of all, thanks for the work! This package is amazing. As others, I've started using blogdown for an easy integration of htmlwidgets. I've tested several themes and in all of them, the htmlwidgets doesn't look good in mobile.

The problem I have is that the width of the htmlwidgets, when browsing from a phone, is always in pixels and they doesn't adjust correctly to the screen. To solve this, I need to set the parameter width="100%" when initializing all the htmlwidgets so they can have a "responsive behaviour".

Sorry if the question is not for this package but: Which is the best way to solve this issue? I want that by default, all the htmlwidgets to have a more mobile-friendly style without manually inserting width=100% when creating the htmlwidget.

Should I look for a Hugo Theme with specific css? Should I config some global parameter of blogdonw/knitr?

Thanks!

Support for R Notebooks?

Wondered if there were plans to support notebooks as well as plain rmd files? Briefly tried including these in the template version in the package but they don't render as blogposts.

blog post only shows up if url is entered

this entry
cranlogs_1

As you, hopefully, see there is some text "/BLOGDOWN-BODY-BEFORE -->" occurring at the top
and the sidebar has some vacant entries - one of which should be where this shows up

Its blog category also fails to appear as does the plot I would expect to see from the code

The same problem occurs locally

Using crosstalk in a blogdown document causing weird CSS effect

In my blog, I want to use the crosstalk library in my code but it causing the rendered page to behave unexpectedly

This the look I want
nosdcode

and this is what I am getting when I add a couple of lines of code

sdcode

library(crosstalk)
sd <- SharedData$new(chickwts)
filter_select("feedtype", "Feed type", sd, ~feed)

Inspecting the code in the latter for the h1, i get this

fontsizesdcode

I have posted a real life case here if you need to delve deeper

I'm using these versions
crosstalk_1.0.1
blogdown_0.0.14

Should I be posting this on the crosstalk issues as well?

thanks

Support for Hugo Shortcodes in Rmd files

Thank you for a great package! A really nice feature of Hugo is shortcodes. When Hugo encounters these snippets in a markdown file it renders small HTML templates into the output HTML file, eg

{{< tweet 820477439050731521 >}}

would embed the tweet into the output HTML.

It would be great if support for shortcodes could be added to Rmd files. I tried to use rmarkdown::md_document(preserve_yaml = TRUE) to first render Rmd to md, but < and > in the shortcode snippet would always get rewritten as < and > in the rendered md file

{{&lt; tweet 820477439050731521 &gt;}}

thereby thwarting Hugo.

Or is there perhaps a knitr option?

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.