BlackFriday AutoHeadingIDs extension not working

You’re right, @maiki, having the code readily available would have helped a lot. I should have created a test project to demonstrate the issue. After reading your comment I did exactly that.

With a brand new project using the Hugo Primer theme I found the header ids were generated automatically for me perfectly!

While trying to understand why I realized that some of my headers in my original project were actually having ids generated for them as expected while others were not. I’m a little embarrassed to explain why but in the hopes of helping others who experience the same issue I’ll share. :slightly_smiling_face:

It turns out the “broken” headers that were missing their ids were coming from a custom shortcode that I added. Since the contents of the shortcode were not going through BlackFriday there was no chance whatsoever for the AutoHeadingIDs feature to help me. It makes perfect sense to me now but at the time I was completely lost. Thank you for helping me to get out of that maze. :heart:

For anyone else who experiences something similar, here’s what I did in my shortcode to make things work:

<h2 id="{{anchorize $title}}">{{$title}}</h2>
1 Like