FIX: Show link count only once for oneboxes (PR #13444)

Sometimes oneboxes contain the same link multiple times and the link count was shown for each of them. This commit adds link count only to the most important link, that being either a heading or the header of the onebox.

GitHub

      assert.equal(count(".badge.clicks"), 2);

+an import

      assert.equal(queryAll(".badge.clicks")[0].innerText, "1");
      assert.equal(queryAll(".badge.clicks")[1].innerText, "2");

I think this was supposed to be an object? :slightly_smiling_face: (or a Map even, though that would require Ching the code below)

        </aside>`,

I think we need to provide more details here for the comment to be useful for future readers. What does “best a” means here? From the code, it seems like we want the onebox with the most links?

It refers to the best element, the one that is the most important to the viewer (for example, heading over paragraph link).

This pull request has been mentioned on Discourse Meta. There might be relevant details there: