Skip to content
Advertisement

Problem adding code folding button in blogdown + Anatole theme

I am having a problem adding code folding to Anatole theme in Blogdown. I have followed this blogpost and I managed to add both “Show/Hide all code” and the individual buttons for each code chunk.

The buttons above each code chunk work well but the “Show/Hide all code” button does not.

Here is a post with code in my blog: https://martinolmos.github.io/datos_tic/en/post/2021-11-09-30-day-map-challenge-day-3-and-4/

A funny thing I’ve noticed: when I inspect the button with developer tools and click in event this is what I see:

enter image description here

So, I think that for some reason when I click in the “Show/Hide all code” button it is calling dropdown.js twice and maybe the second call suppresses the first call. Could this be the problem? What can I do to fix it?

I don’t know a lot of html/javascript so I apologize if this is a very basic/dumb question.

Advertisement

Answer

You are right… you are embedding the footer <footer> twice, which adds the events twice. You can view this by looking at the page source in your browser. The first footer is loaded before the header (inside the sidebar). The second one at the bottom of the page.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement