imfing / hextra

🔯 Modern, batteries-included Hugo theme for creating beautiful doc, blog and static websites
https://imfing.github.io/hextra/
MIT License
757 stars 177 forks source link

feat: show breadcrumbs in search results #473

Closed Gr3q closed 1 month ago

Gr3q commented 1 month ago

Shows breadcrumbs instead of the page title for each section of the search results.

For some reason data can be incomplete on our site, I need to figure out why exactly.

netlify[bot] commented 1 month ago

Deploy Preview for hugo-hextra ready!

Name Link
Latest commit 929ffbb6e1c783a33a3ceef7c4422978466b63ea
Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/670d480c4404140008291306
Deploy Preview https://deploy-preview-473--hugo-hextra.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

imfing commented 1 month ago

For some reason data can be incomplete on our site, I need to figure out why exactly.

might be caused by the parsing logic, i suggest you take a look at: https://github.com/imfing/hextra/blob/main/layouts/partials/utils/fragments.html

Gr3q commented 1 month ago

I had a look, it's this line: https://github.com/imfing/hextra/blob/97ea67198b2f5439b5ba727e831ea4f7d30a0df2/assets/json/search-data.json#L10

It excludes pages from search with no content. It affects breadcrumb generation for search if there are ancestors excluded. There are 2 options:

To be honest pages that have children should not be excluded with excludeSearch nor they should be empty most of the time.

It's up to you which option you choose for this PR - for our page I'll have to add content for the relevant pages (as they should have content)

imfing commented 1 month ago

@Gr3q thanks the PR overall makes sense to me.

re: page exclusion that you mentioned

It excludes pages from search with no content.

I kinda forget what was the reason to put that line to exclude page without content. Maybe we could remove that line since we have excludeSearch?

Gr3q commented 1 month ago

I kinda forget what was the reason to put that line to exclude page without content. Maybe we could remove that line since we have excludeSearch?

Can do, I checked before and it doesn't seem to break search in any way, and you can search for the title of empty pages.

Edit: changes added