Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New post rendering TOML instead of YAML for cocoa-enhanced-theme #301

Closed
apreshill opened this issue Jun 11, 2018 · 3 comments
Closed

New post rendering TOML instead of YAML for cocoa-enhanced-theme #301

apreshill opened this issue Jun 11, 2018 · 3 comments
Milestone

Comments

@apreshill
Copy link
Contributor

apreshill commented Jun 11, 2018

Hi,

I asked this on community.rstudio.com awhile ago and other folks could replicate the issue, but no answers. I'm using this theme for teaching this quarter, and all my students are also seeing the same issue, so it appears across operating systems and set ups, but I have only had this issue with the cocoa enhanced theme (https://github.com/mtn/cocoa-eh-hugo-theme).

My issue is that when I try to create a new R Markdown post, the front matter is in TOML markup instead of YAML. This happens whether I use the New Post Add in or the new_post() function.

screen shot 2018-06-10 at 7 50 03 pm

The .Rmd sample post from the example site generates just fine (https://raw.githubusercontent.com/apreshill/ada-blog/master/content/blog/2015-07-23-r-rmarkdown.Rmd).

I'm filing an issue here because the default.md file in the theme looks as it should (as far as I can tell, but if you see otherwise I apologize for placing the issue here!), so I'm wondering if it is a blogdown issue that perhaps others have seen with this or other themes.

My set-up:

  • R version 3.4.1 (I cannot upgrade past that b/c I am using a work computer and they won't let us upgrade our Mac operating systems).
  • Github version of blogdown just updated again tonight.
  • Local hugo version is 0.41

If it helps, here is my repo for the site I'm trying to build: https://github.com/apreshill/ada-blog

Thank you in advance!

@yihui
Copy link
Member

yihui commented Jun 11, 2018

Looks like a regression bug of Hugo. I'm sure it worked sometime last year. I have this internal function to convert TOML to YAML:

blogdown/R/hugo.R

Lines 228 to 241 in ad8be3f

# Hugo cannot convert a single file: https://github.com/gohugoio/hugo/issues/3632
hugo_toYAML = function(file) {
if (identical(trim_ws(readLines(file, 1)), '---')) return()
file = normalizePath(file)
tmp = tempfile(); on.exit(unlink(tmp, recursive = TRUE), add = TRUE)
dir.create(tmp)
file2 = file.path('content', basename(file))
in_dir(tmp, {
dir.create('content'); file.copy(file, file2)
writeLines('baseurl = "/"', 'config.toml')
hugo_convert(unsafe = TRUE)
file.copy(file2, file, overwrite = TRUE)
})
}

I need to investigate what exactly changed in Hugo.

@yihui yihui added this to the v0.6 milestone Jun 11, 2018
@yihui yihui added the bug label Jun 11, 2018
@yihui yihui closed this as completed in fe7be25 Jun 11, 2018
@yihui
Copy link
Member

yihui commented Jun 11, 2018

Should be fixed on blogdown's side now, although I still guess it is a Hugo issue. Thanks for the report!

@apreshill
Copy link
Contributor Author

Thank you @yihui- that worked perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants