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

get theme branch main #541

Closed
5 tasks done
c1au6i0 opened this issue Dec 20, 2020 · 6 comments
Closed
5 tasks done

get theme branch main #541

c1au6i0 opened this issue Dec 20, 2020 · 6 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@c1au6i0
Copy link

c1au6i0 commented Dec 20, 2020

new_site does't download themes if the name of default branch is not master. People started to switch to main...

blogdown::new_site(theme = "wowchemy/starter-research-group")
#> trying URL 'https://github.com/wowchemy/starter-research-group/archive/master.tar.gz'
#> trying URL 'https://github.com/wowchemy/starter-research-group/archive/master.tar.gz'
#>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#>                                  Dload  Upload   Total   Spent    Left  Speed
#> 100   139  100   139    0     0   2316      0 --:--:-- --:--:-- --:--:--  2316
#> 100    14  100    14    0     0    117      0 --:--:-- --:--:-- --:--:--   304
#> tar: Error opening archive: Unrecognized archive format
#> Error in if (dir_exists(expdir)) if (theme_example) { : 
#>   argument is of length zero
#> In addition: Warning messages:
#> 1: In download.file(url, output, ..., method = method) :
#>   cannot open URL 'https://codeload.github.com/wowchemy/starter-research-group/tar.gz/master': HTTP status was '404 Not #> Found'
#> 2: In download.file(url, output, ..., method = method) :
#>   cannot open URL 'https://codeload.github.com/wowchemy/starter-research-group/tar.gz/master': HTTP status was '404 Not #> Found'
#> 3: In utils::untar(zipfile, exdir = tmpdir) :
#>   ‘/usr/bin/tar -xf '172a2fd84d03master.tar.gz' -C '172a241a80815'’ returned error code 1

It does if the main branch is called master, as in the repo that I forked herehttps://github.com/c1au6i0/starter-research-group.

xfun::session_info('blogdown')
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#> 
#> Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8
#> 
#> Package version:
#>   base64enc_0.1.3 BH_1.72.0.3     blogdown_0.21   bookdown_0.21  
#>   digest_0.6.27   evaluate_0.14   glue_1.4.2      graphics_4.0.3 
#>   grDevices_4.0.3 highr_0.8       htmltools_0.5.0 httpuv_1.5.4   
#>   jso

Well I am not sure if that is the problem or not, but that is a possibility I guess

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

  • formatted your issue so it is easier for us to read?

  • included a minimal, self-contained, and reproducible example?

  • pasted the output from xfun::session_info('blogdown') in your issue?

  • upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?

  • installed and tested your bug with the development version of the blogdown package using remotes::install_github('rstudio/blogdown')?

@c1au6i0 c1au6i0 added the bug an unexpected problem or unintended behavior label Dec 20, 2020
@c1au6i0 c1au6i0 closed this as completed Dec 20, 2020
@c1au6i0 c1au6i0 reopened this Dec 20, 2020
@apreshill
Copy link
Contributor

apreshill commented Dec 21, 2020

Hi- if you use ?new_site the theme argument help docs say:

A Hugo theme on Github (a character string of the form user/repo, and you can optionally specify a GIT branch or tag name after @, i.e. theme can be of the form user/repo@branch). You can also specify a full URL to the zip file or tarball of the theme.

So I just tried this and it "worked" (although the exampleSite results in a Hugo shortcode error):

blogdown::new_site(theme = "wowchemy/starter-research-group@main")

@c1au6i0
Copy link
Author

c1au6i0 commented Dec 21, 2020

Got it, sorry not sure why I missed that in the documentation.

@c1au6i0 c1au6i0 closed this as completed Dec 21, 2020
@yihui
Copy link
Member

yihui commented Dec 21, 2020

You can specify the branch after @, e.g.,

blogdown::new_site(theme = "wowchemy/starter-research-group@main")

This is documented on the help page ?blogdown::new_site.

That said, I agree it should do a better job to just figure out the default branch automatically. Thanks for the report!


Update: Oh I didn't realize @apreshill had already replied. Again, I'll improve this function so you don't have to specify @main in the future.

@yihui yihui reopened this Dec 21, 2020
@yihui yihui closed this as completed in f596265 Dec 21, 2020
@yihui
Copy link
Member

yihui commented Dec 21, 2020

Done. The development version should be able to figure out the default branch now:

remotes::install_github('rstudio/blogdown')

@yihui
Copy link
Member

yihui commented Dec 21, 2020

Also note that wowchemy/starter-research-group is not really a theme (but a sample site instead), so it won't work with new_site() at the moment. I might be able to figure out how to make it work with new_site() in the future, after I know more about these "Hugo modules" (which is currently still a pain to me).

yihui added a commit that referenced this issue Dec 21, 2020
@yihui
Copy link
Member

yihui commented Dec 21, 2020

It should work now:

remotes::install_github('rstudio/blogdown')
blogdown::new_site(theme = "wowchemy/starter-research-group")

yihui added a commit that referenced this issue Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants