Is it possible to have multiple Rmd file templates for the blogdown “new post” addin?
I'd like to be able to select among two (or more) archetypes when using the "new post" addin in blogdown. The screenshots at https://github.com/rstudio/blogdown/pull/263 suggest that, if I add a "post.md" file to the archetypes directory in my theme then it will be available in the Archetype dropdown menu. However, I've added such a file, and even after restarting R I don't get anything other than "default" as an option.
Looking at new_post.R, it seems that the key phrase is
choices = unique(c('default', xfun::sans_ext(dir('archetypes', '\.md$'))
but I don't see anywhere that the path to the theme is being defined, suggesting that the latter part doesn't find a valid directory and so isn't actually generating a list of files.
Indeed, if I change 'default' to 'foo' in the above line, then my only option in the Archetype menu is foo.
I should note that edits I make to defaults.md in my archetypes directory do get applied by new_post, so hugo is finding the directory; it is just the shiny app that appears not to find it.
I originally found this using the current release version (0.9); I get the same result using v. 9.2 from GitHub.
It may well be that I'm missing something fundamental (e.g., an options setting somewhere), and if so I apologize :-)
r hugo blogdown
add a comment |
I'd like to be able to select among two (or more) archetypes when using the "new post" addin in blogdown. The screenshots at https://github.com/rstudio/blogdown/pull/263 suggest that, if I add a "post.md" file to the archetypes directory in my theme then it will be available in the Archetype dropdown menu. However, I've added such a file, and even after restarting R I don't get anything other than "default" as an option.
Looking at new_post.R, it seems that the key phrase is
choices = unique(c('default', xfun::sans_ext(dir('archetypes', '\.md$'))
but I don't see anywhere that the path to the theme is being defined, suggesting that the latter part doesn't find a valid directory and so isn't actually generating a list of files.
Indeed, if I change 'default' to 'foo' in the above line, then my only option in the Archetype menu is foo.
I should note that edits I make to defaults.md in my archetypes directory do get applied by new_post, so hugo is finding the directory; it is just the shiny app that appears not to find it.
I originally found this using the current release version (0.9); I get the same result using v. 9.2 from GitHub.
It may well be that I'm missing something fundamental (e.g., an options setting somewhere), and if so I apologize :-)
r hugo blogdown
add a comment |
I'd like to be able to select among two (or more) archetypes when using the "new post" addin in blogdown. The screenshots at https://github.com/rstudio/blogdown/pull/263 suggest that, if I add a "post.md" file to the archetypes directory in my theme then it will be available in the Archetype dropdown menu. However, I've added such a file, and even after restarting R I don't get anything other than "default" as an option.
Looking at new_post.R, it seems that the key phrase is
choices = unique(c('default', xfun::sans_ext(dir('archetypes', '\.md$'))
but I don't see anywhere that the path to the theme is being defined, suggesting that the latter part doesn't find a valid directory and so isn't actually generating a list of files.
Indeed, if I change 'default' to 'foo' in the above line, then my only option in the Archetype menu is foo.
I should note that edits I make to defaults.md in my archetypes directory do get applied by new_post, so hugo is finding the directory; it is just the shiny app that appears not to find it.
I originally found this using the current release version (0.9); I get the same result using v. 9.2 from GitHub.
It may well be that I'm missing something fundamental (e.g., an options setting somewhere), and if so I apologize :-)
r hugo blogdown
I'd like to be able to select among two (or more) archetypes when using the "new post" addin in blogdown. The screenshots at https://github.com/rstudio/blogdown/pull/263 suggest that, if I add a "post.md" file to the archetypes directory in my theme then it will be available in the Archetype dropdown menu. However, I've added such a file, and even after restarting R I don't get anything other than "default" as an option.
Looking at new_post.R, it seems that the key phrase is
choices = unique(c('default', xfun::sans_ext(dir('archetypes', '\.md$'))
but I don't see anywhere that the path to the theme is being defined, suggesting that the latter part doesn't find a valid directory and so isn't actually generating a list of files.
Indeed, if I change 'default' to 'foo' in the above line, then my only option in the Archetype menu is foo.
I should note that edits I make to defaults.md in my archetypes directory do get applied by new_post, so hugo is finding the directory; it is just the shiny app that appears not to find it.
I originally found this using the current release version (0.9); I get the same result using v. 9.2 from GitHub.
It may well be that I'm missing something fundamental (e.g., an options setting somewhere), and if so I apologize :-)
r hugo blogdown
r hugo blogdown
asked Nov 14 '18 at 22:18
Bruce KendallBruce Kendall
234
234
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You should add the .md
file to the archetypes
directory of your website root directory, instead of the theme directory.
Thanks! My site root directory did not already have anarchetypes
directory (and hence when I went looking forarchetypes
, the only place I found it was in the theme), so I had to create one. Putting the.md
files there indeed solved the problem. I also note thatdefault.md
in the sitearchetypes
overrides the one in the theme.
– Bruce Kendall
Nov 20 '18 at 14:53
Great. Glad to know it works for you now!
– Yihui Xie
Nov 20 '18 at 15:18
Hi @YihuiXie. I've been using Hugo for a while now and the ability that provides blogdown to write.Rmd
files is really great but when it comes to archetypes handle I really don't get it. I mean, the official documentation about archetypes stablish a lookup order for the archerype declaration as long as the theme name is set in theconfig.toml
file so there's no need to place the files in the root directory. Is there a way to go with this default behaviour or to copy, by default, the folder from the themes directory to the root directory?
– David Daza
Nov 30 '18 at 17:22
@DavidDaza I just made a few changes in the dev version of blogdown. Please test it withremotes::install_github('rstudio/blogdown')
. This version will respect Hugo's lookup order for archetypes, and will also list the available archetypes in the theme. Thanks!
– Yihui Xie
Dec 4 '18 at 5:25
Awesome, i'ts working for me now as expected. Thank you!
– David Daza
Dec 4 '18 at 18:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309582%2fis-it-possible-to-have-multiple-rmd-file-templates-for-the-blogdown-new-post-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should add the .md
file to the archetypes
directory of your website root directory, instead of the theme directory.
Thanks! My site root directory did not already have anarchetypes
directory (and hence when I went looking forarchetypes
, the only place I found it was in the theme), so I had to create one. Putting the.md
files there indeed solved the problem. I also note thatdefault.md
in the sitearchetypes
overrides the one in the theme.
– Bruce Kendall
Nov 20 '18 at 14:53
Great. Glad to know it works for you now!
– Yihui Xie
Nov 20 '18 at 15:18
Hi @YihuiXie. I've been using Hugo for a while now and the ability that provides blogdown to write.Rmd
files is really great but when it comes to archetypes handle I really don't get it. I mean, the official documentation about archetypes stablish a lookup order for the archerype declaration as long as the theme name is set in theconfig.toml
file so there's no need to place the files in the root directory. Is there a way to go with this default behaviour or to copy, by default, the folder from the themes directory to the root directory?
– David Daza
Nov 30 '18 at 17:22
@DavidDaza I just made a few changes in the dev version of blogdown. Please test it withremotes::install_github('rstudio/blogdown')
. This version will respect Hugo's lookup order for archetypes, and will also list the available archetypes in the theme. Thanks!
– Yihui Xie
Dec 4 '18 at 5:25
Awesome, i'ts working for me now as expected. Thank you!
– David Daza
Dec 4 '18 at 18:50
add a comment |
You should add the .md
file to the archetypes
directory of your website root directory, instead of the theme directory.
Thanks! My site root directory did not already have anarchetypes
directory (and hence when I went looking forarchetypes
, the only place I found it was in the theme), so I had to create one. Putting the.md
files there indeed solved the problem. I also note thatdefault.md
in the sitearchetypes
overrides the one in the theme.
– Bruce Kendall
Nov 20 '18 at 14:53
Great. Glad to know it works for you now!
– Yihui Xie
Nov 20 '18 at 15:18
Hi @YihuiXie. I've been using Hugo for a while now and the ability that provides blogdown to write.Rmd
files is really great but when it comes to archetypes handle I really don't get it. I mean, the official documentation about archetypes stablish a lookup order for the archerype declaration as long as the theme name is set in theconfig.toml
file so there's no need to place the files in the root directory. Is there a way to go with this default behaviour or to copy, by default, the folder from the themes directory to the root directory?
– David Daza
Nov 30 '18 at 17:22
@DavidDaza I just made a few changes in the dev version of blogdown. Please test it withremotes::install_github('rstudio/blogdown')
. This version will respect Hugo's lookup order for archetypes, and will also list the available archetypes in the theme. Thanks!
– Yihui Xie
Dec 4 '18 at 5:25
Awesome, i'ts working for me now as expected. Thank you!
– David Daza
Dec 4 '18 at 18:50
add a comment |
You should add the .md
file to the archetypes
directory of your website root directory, instead of the theme directory.
You should add the .md
file to the archetypes
directory of your website root directory, instead of the theme directory.
answered Nov 16 '18 at 16:23
Yihui XieYihui Xie
20.8k11106284
20.8k11106284
Thanks! My site root directory did not already have anarchetypes
directory (and hence when I went looking forarchetypes
, the only place I found it was in the theme), so I had to create one. Putting the.md
files there indeed solved the problem. I also note thatdefault.md
in the sitearchetypes
overrides the one in the theme.
– Bruce Kendall
Nov 20 '18 at 14:53
Great. Glad to know it works for you now!
– Yihui Xie
Nov 20 '18 at 15:18
Hi @YihuiXie. I've been using Hugo for a while now and the ability that provides blogdown to write.Rmd
files is really great but when it comes to archetypes handle I really don't get it. I mean, the official documentation about archetypes stablish a lookup order for the archerype declaration as long as the theme name is set in theconfig.toml
file so there's no need to place the files in the root directory. Is there a way to go with this default behaviour or to copy, by default, the folder from the themes directory to the root directory?
– David Daza
Nov 30 '18 at 17:22
@DavidDaza I just made a few changes in the dev version of blogdown. Please test it withremotes::install_github('rstudio/blogdown')
. This version will respect Hugo's lookup order for archetypes, and will also list the available archetypes in the theme. Thanks!
– Yihui Xie
Dec 4 '18 at 5:25
Awesome, i'ts working for me now as expected. Thank you!
– David Daza
Dec 4 '18 at 18:50
add a comment |
Thanks! My site root directory did not already have anarchetypes
directory (and hence when I went looking forarchetypes
, the only place I found it was in the theme), so I had to create one. Putting the.md
files there indeed solved the problem. I also note thatdefault.md
in the sitearchetypes
overrides the one in the theme.
– Bruce Kendall
Nov 20 '18 at 14:53
Great. Glad to know it works for you now!
– Yihui Xie
Nov 20 '18 at 15:18
Hi @YihuiXie. I've been using Hugo for a while now and the ability that provides blogdown to write.Rmd
files is really great but when it comes to archetypes handle I really don't get it. I mean, the official documentation about archetypes stablish a lookup order for the archerype declaration as long as the theme name is set in theconfig.toml
file so there's no need to place the files in the root directory. Is there a way to go with this default behaviour or to copy, by default, the folder from the themes directory to the root directory?
– David Daza
Nov 30 '18 at 17:22
@DavidDaza I just made a few changes in the dev version of blogdown. Please test it withremotes::install_github('rstudio/blogdown')
. This version will respect Hugo's lookup order for archetypes, and will also list the available archetypes in the theme. Thanks!
– Yihui Xie
Dec 4 '18 at 5:25
Awesome, i'ts working for me now as expected. Thank you!
– David Daza
Dec 4 '18 at 18:50
Thanks! My site root directory did not already have an
archetypes
directory (and hence when I went looking for archetypes
, the only place I found it was in the theme), so I had to create one. Putting the .md
files there indeed solved the problem. I also note that default.md
in the site archetypes
overrides the one in the theme.– Bruce Kendall
Nov 20 '18 at 14:53
Thanks! My site root directory did not already have an
archetypes
directory (and hence when I went looking for archetypes
, the only place I found it was in the theme), so I had to create one. Putting the .md
files there indeed solved the problem. I also note that default.md
in the site archetypes
overrides the one in the theme.– Bruce Kendall
Nov 20 '18 at 14:53
Great. Glad to know it works for you now!
– Yihui Xie
Nov 20 '18 at 15:18
Great. Glad to know it works for you now!
– Yihui Xie
Nov 20 '18 at 15:18
Hi @YihuiXie. I've been using Hugo for a while now and the ability that provides blogdown to write
.Rmd
files is really great but when it comes to archetypes handle I really don't get it. I mean, the official documentation about archetypes stablish a lookup order for the archerype declaration as long as the theme name is set in the config.toml
file so there's no need to place the files in the root directory. Is there a way to go with this default behaviour or to copy, by default, the folder from the themes directory to the root directory?– David Daza
Nov 30 '18 at 17:22
Hi @YihuiXie. I've been using Hugo for a while now and the ability that provides blogdown to write
.Rmd
files is really great but when it comes to archetypes handle I really don't get it. I mean, the official documentation about archetypes stablish a lookup order for the archerype declaration as long as the theme name is set in the config.toml
file so there's no need to place the files in the root directory. Is there a way to go with this default behaviour or to copy, by default, the folder from the themes directory to the root directory?– David Daza
Nov 30 '18 at 17:22
@DavidDaza I just made a few changes in the dev version of blogdown. Please test it with
remotes::install_github('rstudio/blogdown')
. This version will respect Hugo's lookup order for archetypes, and will also list the available archetypes in the theme. Thanks!– Yihui Xie
Dec 4 '18 at 5:25
@DavidDaza I just made a few changes in the dev version of blogdown. Please test it with
remotes::install_github('rstudio/blogdown')
. This version will respect Hugo's lookup order for archetypes, and will also list the available archetypes in the theme. Thanks!– Yihui Xie
Dec 4 '18 at 5:25
Awesome, i'ts working for me now as expected. Thank you!
– David Daza
Dec 4 '18 at 18:50
Awesome, i'ts working for me now as expected. Thank you!
– David Daza
Dec 4 '18 at 18:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309582%2fis-it-possible-to-have-multiple-rmd-file-templates-for-the-blogdown-new-post-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown