I have noticed a peculiar thing about footnotes in headings. They show up nicely in the main document, but add visual clutter to the table of contents, as shown on my example below (click here to open).
#set page(paper: "a7")
== My Heading #footnote[#link("https://typst.app/")[Link to typst];]
#lorem(50)
this is a known issue tracked in #2415. There are some solutions in a related thread (1889).
There are different ways to do this, but the simplest one I recommend is to split the bookmark and the actual heading. Then, it’s just a matter of convenience. You can wrap it all in a custom function.