Images in Menu Entries

Is that method still working in 2021? Image does not show up for me. In config.toml I have:

[[languages.en.menu.main]]
    name = "DEU"
    url = "/de/test/"
    weight = "9"
    pre = "<img src='/uploads/de32.png'>"

When I use name = for the image I just get the code. What I am doing wrong?

Hi there,

Please do not resurrect 4+ years old topics. I’ve moved your question into its own topic.

Have a read about Requesting Help to see how to make it easier to get help here.

Do you have your code in a repo somewhere we can replicate?

What version of Hugo are you using?

How are you rendering the menu in your template?

I am aware of the year, but since it was like a follow up I didn’t feel it was right to open a new topic. It seems that in 2017 it worked and I wonder why I can’t make it work.

The code is only on my PC. Version is 0.88.1 ext. Windows 64

Theme is Travelify. I don’t know how it renders, but the menu works fine on localhost:1313 - just can’t see that flag image.

This seems to be the bit that renders the menu for that theme. It does not use the pre Menu Variable; therefore it never gets called.

Thanks for that hint! I should probably look into another theme. The “Pre” isn’t a major issue, just a nice to have. But this theme does not display the mobile menu (it disappears).