Code Monkey home page Code Monkey logo

Comments (14)

mrjbq7 avatar mrjbq7 commented on June 24, 2024 1

Thank you so much for the quick response, and this pagefind thing is awesome. ❤️

from pagefind.

fanf2 avatar fanf2 commented on June 24, 2024

I guess the fix is to change {data.meta?.title} to {@html data.meta?.title} in pagefind_ui/svelte/result.svelte

from pagefind.

fanf2 avatar fanf2 commented on June 24, 2024

For now I have fixed this for myself by monkeypatching the JS bundle, so you will not see the issue on my site as I described above. (I was keen to get it working!)

from pagefind.

bglw avatar bglw commented on June 24, 2024

Ah, yep good spot. I'll get that released for you this week.

from pagefind.

wgroeneveld avatar wgroeneveld commented on June 24, 2024

I have a similar issue but I'm not sure if it's 100% the same.
I have a blog post that starts with "I'm joining" and gets displayed via Pagefind as "I'm Joining". I'm having trouble debugging the issue but could this also be resolved with the {@html fix mentioned by @fanf2 ? It's also a title problem.
Thanks!
Heard about the tool in HugoConf and keen to replace Lunr.js as the index file started to clog up! Cheers!

from pagefind.

bglw avatar bglw commented on June 24, 2024

Hi @wgroeneveld — yes that looks like the same issue, but I'll make sure to test it directly before the next release.

from pagefind.

bglw avatar bglw commented on June 24, 2024

Hi @fanf2 and @wgroeneveld 👋

Fixes for HTML entities have been released in Pagefind v0.5.0 🎉

from pagefind.

wgroeneveld avatar wgroeneveld commented on June 24, 2024

Hi @fanf2 and @wgroeneveld 👋

Fixes for HTML entities have been released in Pagefind v0.5.0 🎉

Awesome thanks!

from pagefind.

mrjbq7 avatar mrjbq7 commented on June 24, 2024

I still have this happen in Pagefind 1.0.3.

from pagefind.

mrjbq7 avatar mrjbq7 commented on June 24, 2024

For example, using this markup:

<h2 data-pagefind-meta="title"><span class="title">Faster &#34;shuffle&#34;</span></h2>

from pagefind.

bglw avatar bglw commented on June 24, 2024

Ah, my mistake, I did regress this in 1.0. 

We need to avoid rendering some things as HTML (for example, on MDN where pages are titled the <aside> element — but in resolving that I have reintroduced the title display error from this issue.

I'll get this re-fixed up for the next release — sorry about that.

(The indexing bug has not been introduced, just the display bug)

from pagefind.

bglw avatar bglw commented on June 24, 2024

In the meantime, PagefindUI's processResult hook could be used to normalize the titles before display.

from pagefind.

mrjbq7 avatar mrjbq7 commented on June 24, 2024

This seems to work, there might be a more elegant way to unescape:

      new PagefindUI({
          element: "#search",
          showSubResults: true,
          resetStyles: false,
          processResult: function (result) {
              var title = new DOMParser().parseFromString(result.meta.title, "text/html");
              result.meta.title = title.documentElement.textContent;
              return result;
          }
      });

from pagefind.

bglw avatar bglw commented on June 24, 2024

I was about to write a larger note about how I cannot reproduce this, but it only seems to apply if you're using a custom data-pagefind-meta="title" attribute. The automatic h1 title capture works fine — so that will make the fix simpler (and also means this doesn't affect most sites).

(example: searching greater than on https://mdn.pagefind.app/)

That processResult looks fine to me! At least as a temporary stop-gap 🙂

from pagefind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.