Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pagefind weight frontmatter #2371

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

lorenzolewis
Copy link
Contributor

@lorenzolewis lorenzolewis commented Sep 19, 2024

Description

Question

By keeping the weight key required if it's an object for now, we can still add more keys in the future and mark the weight key as optional without any breaking change issues, right? Or would it be better to mark it as "optional" now and handle that additional check in this PR?

Copy link

changeset-bot bot commented Sep 19, 2024

🦋 Changeset detected

Latest commit: 820161b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Sep 19, 2024
Copy link

netlify bot commented Sep 19, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 820161b
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/66ec3e159eb49b00082ae0d4
😎 Deploy Preview https://deploy-preview-2371--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@astrobot-houston
Copy link
Collaborator

astrobot-houston commented Sep 19, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/site-search.mdx Source changed, localizations will be marked as outdated.
en reference/frontmatter.md Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@astrobot-houston
Copy link
Collaborator

astrobot-houston commented Sep 19, 2024

size-limit report 📦

Path Size
/index.html 6.15 KB (0%)
/_astro/*.js 22.36 KB (-0.02% 🔽)
/_astro/*.css 13.72 KB (0%)

@github-actions github-actions bot removed the 📚 docs Documentation website changes label Sep 19, 2024
@github-actions github-actions bot added the 📚 docs Documentation website changes label Sep 19, 2024
@lorenzolewis lorenzolewis marked this pull request as ready for review September 19, 2024 15:11
@lorenzolewis lorenzolewis changed the title Draft: Pagefind weight frontmatter Add Pagefind weight frontmatter Sep 19, 2024
Comment on lines +45 to +49
## Adjust ranking in search results

Pagefind's index ranking can be adjusted using the [`data-pagefind-weight`](https://pagefind.app/docs/weighting/#ranking-content-higher-or-lower) attribute. This can be used to [adjust a whole page](#adjust-whole-page-rank) or [individual sections of a page](#adjust-individual-section-rank).

Learn more about about how the weight value impacts search results in the [Pagefind Weighting content guide](https://pagefind.app/docs/weighting/).
Copy link
Member

@ematipico ematipico Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to explain to users when they should change the ranking, and why. The docs of pagefind only explain some technical stuff, but from the point of view of a maintainer like myself, it would be nice to have some guidance on why I should use it.

Copy link
Contributor Author

@lorenzolewis lorenzolewis Sep 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Adjust ranking in search results
Pagefind's index ranking can be adjusted using the [`data-pagefind-weight`](https://pagefind.app/docs/weighting/#ranking-content-higher-or-lower) attribute. This can be used to [adjust a whole page](#adjust-whole-page-rank) or [individual sections of a page](#adjust-individual-section-rank).
Learn more about about how the weight value impacts search results in the [Pagefind Weighting content guide](https://pagefind.app/docs/weighting/).
## Adjust ranking in search results
Pagefind's index ranking can be adjusted using the [`data-pagefind-weight`](https://pagefind.app/docs/weighting/#ranking-content-higher-or-lower) attribute. This can be used to [adjust a whole page](#adjust-whole-page-rank) or [individual sections of a page](#adjust-individual-section-rank).
For example, if there is a high-level guide that is a better entry point for readers than an error reference page containing similar keywords, increasing the weight of the guide page will cause it to be ranked higher in the Pagefind search results.
Learn more about about how the weight value impacts search results in the [Pagefind Weighting content guide](https://pagefind.app/docs/weighting/).

@ematipico Thanks! Do you think this gives a good example of the usage here? Happy for any suggestions if anything else comes to mind 🥳

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're getting somewhere I think. Now we should explain when to increase the page weight and when decrease the page weight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package 📚 docs Documentation website changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants