oleeskild / digitalgarden

275 stars 158 forks source link

Links to headers are rendered as tags and are broken #185

Closed bayang closed 1 year ago

bayang commented 1 year ago

When I use a link that points to a header inside the same note, like this :

Ce système motorise aussi le jeu [[#hostille]].

It is rendered as :

<a class="tag" onclick="toggleTagSearch(this)" data-content="#hostile">#hostile</a>

Which means it is styled as a tag and when it is clicked it does not direct the user to the header but opens the search bar instead.

Screenshot_20230626_175337

I think that the problem could be the "taggify" filter in the .eleventy.js file. :

eleventyConfig.addFilter("taggify", function (str) {
    return (
      str &&
      str.replace(tagRegex, function (match, precede, tag) {
        return `${precede}<a class="tag" onclick="toggleTagSearch(this)" data-content="${tag}">${tag}</a>`;
      })
    );
  });
F4bbi commented 1 year ago

A simple workaround I use to avoid the problem is to use '|' to rename the link, in your case like [[#hostile|hostile]].

bayang commented 1 year ago

Hum weird, I tried this at first but when I went to check my deployed instance on vercel links were still broken. But now that I check 2 hours later, links are fine... I guess I have been bitten by a cache on vercel's side or in my browser.

We can close this, even if it's only a workaround.

Thanks for your help anyway @F4bbi .