Having nested elements on blogdown/hugo archetypes

I have an archetypes for talks with some content like this on archetypes/talk.md:

links:
  - icon: images
    icon_pack: fas
    name: slides
    url:
  - icon: github
    icon_pack: fab
    name: code
    url:
  - icon: youtube
    icon_pack: fab
    name: video
    url: 

However, the generate talk using this template loses the "- " in front of the icon. It ends up like this:

links:
  icon: images
  icon_pack: fas
  name: slides
  url: ~
  icon: github
  icon_pack: fab
  name: code
  url: ~
  icon: youtube
  icon_pack: fab
  name: video
  url: ~

But this is invalid yaml as there are duplicated map keys and the content with tabs has been indented the same as icon.

Is there a way to escape this? I tried adding it like this [icon: youtube] adding more indentation, escaping it with \- and \--, but all these fail for one reason or another . I haven't found how to write the right format on the official documentation from Hugo or blogdown (where the only documentation of this is on templates but I couldn't find anything about how to write them).
Thanks

This looks like a bug in blogdown :thinking: It is possible that we are processing the archetype but not sure.
Could be Hugo too.

Which blogdown version are you using ? Which is the Hugo version ? Are you using default behavior of blogdown or do you have specific customization ?

the generate talk using this template

The HTLM file ?

Thanks for the fast reply, I'm using hugo version 0.91.2, blogdown 1.7 on R 4.1.2.
I have on my .Rprofile the following configuration of blogdown (aside from that I don't think I have anything else, but you can check my blog source code ):

options(blogdown.author = "Lluís Revilla Sancho",
        blogdown.ext = ".Rmd",
        blogdown.knit.on_save = TRUE,
        blogdown.hugo.version = "0.91.2",
        bitmapType = "cairo",
        xfun.bg_process.verbose = TRUE,
        blogdown.use.processx = FALSE)

When I say to generate a talk using this template I mean the *.Rmd file created by the blogdown:::new_post_adding() selecting the archetype the one with links: - icon: ..... That *.Rmd file doesn't contain the -.

yes I believe this is an issue in blogdown. There is a modify_yaml used to add fields in the archetype for the post created and this function does correctly handle the YAML.

I have created an issue with a reprex in here:

1 Like

Many thanks, I hope that the fix is easy (and looking forward to the feature of keeping comments).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.