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 add-in doesn't work with page bundle archetypes #414

Closed
malcolmbarrett opened this issue Oct 19, 2019 · 5 comments
Closed

New post add-in doesn't work with page bundle archetypes #414

malcolmbarrett opened this issue Oct 19, 2019 · 5 comments
Labels
bug

Comments

@malcolmbarrett
Copy link

@malcolmbarrett malcolmbarrett commented Oct 19, 2019

@apreshill have noticed that, under some circumstances, the new post add-in is not using archetypes correctly. I think that it is related to page bundles. Here is a test site that shows the issue: https://github.com/malcolmbarrett/bundleexample. For this site, the add-in calls the archetype that is set up as a single .md file correctly but not for the one where it's bundled.

I'm not 100% sure, but after experimenting a bit, this seems to do with hugo new. It seems that if the path is a file name, it won't use the page bundle archetype, e.g. hugo new dir -k myarchetype works but hugo new dir/mypost.md -k myarchetype does not.

A solution might be something like this, although I don't think the actual implementation can be quite this simple.

path = ifelse(utils::file_test("-d", kind), dirname(path), path)
# pass along to `hugo_cmd()` in some capacity...

Anyway, I'll wait on some guidance because I am uncertain about this issue, but I'm happy to try a PR if you agree with this diagnosis


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('blogdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/blogdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.
xfun::session_info('blogdown')
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6, RStudio 1.2.5001

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.69.0.1     blogdown_0.16.1 bookdown_0.14   digest_0.6.21   evaluate_0.14  
  glue_1.3.1      graphics_3.6.1  grDevices_3.6.1 highr_0.8       htmltools_0.4.0 httpuv_1.5.2   
  jsonlite_1.6    knitr_1.25      later_1.0.0     magrittr_1.5    markdown_1.1    methods_3.6.1  
  mime_0.7        promises_1.1.0  R6_2.4.0        Rcpp_1.0.2      rlang_0.4.0     rmarkdown_1.16 
  servr_0.15      stats_3.6.1     stringi_1.4.3   stringr_1.4.0   tinytex_0.16    tools_3.6.1    
  utils_3.6.1     xfun_0.10       yaml_2.2.0     
@apreshill

This comment has been minimized.

Copy link
Member

@apreshill apreshill commented Nov 4, 2019

I'm experiencing the same issue with a custom theme which can be installed from this github repo: https://github.com/rstudio/hugo-tourmaline

The following Hugo commands from the terminal work perfectly- I get a new bundled blog post in the right place that pulls in the YAML properly from my theme's archetype:

hugo new blog/help-me

This does not work using Hugo from the terminal:

hugo new blog/help-me/index.md

The blogdown new post add in never finds the right archetype- a new bundled post is created but the YAML from my archetype does not show up.

@yihui yihui added the bug label Nov 12, 2019
@yihui yihui closed this in a93ae13 Nov 13, 2019
@yihui

This comment has been minimized.

Copy link
Member

@yihui yihui commented Nov 13, 2019

Should be fixed now. Thanks for the report!

BTW, page bundle archetypes are now indicated by a trailing slash:

image

@malcolmbarrett

This comment has been minimized.

Copy link
Author

@malcolmbarrett malcolmbarrett commented Nov 13, 2019

Thanks, Yihui!

@yihui

This comment has been minimized.

Copy link
Member

@yihui yihui commented Nov 13, 2019

No problem. If you have tested it, I can make a CRAN release later today.

@malcolmbarrett

This comment has been minimized.

Copy link
Author

@malcolmbarrett malcolmbarrett commented Nov 13, 2019

Works great with the example I posted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.