Comments (14)
Thank you so much for the quick response, and this pagefind thing is awesome. ❤️
from pagefind.
I guess the fix is to change {data.meta?.title}
to {@html data.meta?.title}
in pagefind_ui/svelte/result.svelte
from pagefind.
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.
Ah, yep good spot. I'll get that released for you this week.
from pagefind.
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.
Hi @wgroeneveld — yes that looks like the same issue, but I'll make sure to test it directly before the next release.
from pagefind.
Hi @fanf2 and @wgroeneveld 👋
Fixes for HTML entities have been released in Pagefind v0.5.0 🎉
from pagefind.
Hi @fanf2 and @wgroeneveld 👋
Fixes for HTML entities have been released in Pagefind v0.5.0 🎉
Awesome thanks!
from pagefind.
I still have this happen in Pagefind 1.0.3.
from pagefind.
For example, using this markup:
<h2 data-pagefind-meta="title"><span class="title">Faster "shuffle"</span></h2>
from pagefind.
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.
In the meantime, PagefindUI's processResult hook could be used to normalize the titles before display.
from pagefind.
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.
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)
- [Question] "Slow" first load HOT 8
- search results are returned when they shouldn't be, with non matching terms highlighted HOT 2
- Do not download content/rawContent when loading search result data HOT 4
- Support search api in webworker
- Making result (pagefind-ui__result) clickable instead of title HOT 5
- Broken image sources in Hugo with base64 encoded images HOT 2
- Pagefind wasn't able to build an index HOT 1
- How do I get pagefind to work with the nextjs app router? HOT 1
- Dark mode in default pagefind-modular-ui.css HOT 6
- H1 elements not being indexed HOT 2
- [Feature request] Score exact name of page highly HOT 1
- The path to the image is not found
- Special characters (p.e. Umlauts) in page's file names are not escaped, causing not working links HOT 2
- CSS Validation Parse Error: .pagefind-ui__button.svelte-193m69l | Value Error : color ----pagefind-ui-primary HOT 1
- Runtime error "unreachable executed" when search term contains emoticon HOT 1
- Support of specific "target" for <a> links by default UI to open result documents in different frame HOT 2
- ModularUI results do not update on scroll HOT 4
- Sort ModularUI FilterPills HOT 2
- Difference in the results by including `a` in the middle. HOT 4
- Problem with domains and subdomains HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pagefind.