Create a table of contents (toc) in a post with blogdown package

1.9k Views Asked by At

I know the short answer, add the following in the metadata toc: TRUE

But when I create a post with the blogdown package that have a table of content, I have problems with the url (redirection) behind the table options.

The links for the table of content are of the following form:

http://home-website/#tree-terminology

Instead to be:

http://home-website/post_name/#tree-terminology

How can reference the name of the post correctly in the url to generate the proper url in the table of content? In which part can find the configuration behind the toc behavior?

1

There are 1 best solutions below

2
On

As per Yihui's Github (https://github.com/yihui/hugo-xmin/pull/7), you might need to put

output:
  blogdown::html_page:
    toc: true

in your YAML. It's working properly on my website.