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

Augment pages with custom ranking and/or a featured flag? #79

Closed
idvorkin opened this issue Aug 3, 2018 · 3 comments
Closed

Augment pages with custom ranking and/or a featured flag? #79

idvorkin opened this issue Aug 3, 2018 · 3 comments

Comments

@idvorkin
Copy link

idvorkin commented Aug 3, 2018

I want to suggest a feature:

I'd like to easily augment my pages with custom ranking and a featured flag.

What is your use case for such a feature?

I want to control what pages appear first. I want to do this both explicitly by rank as well as by adding a post tag.

@pixelastic
Copy link
Collaborator

Hello and thanks for the feature request.

What you're suggesting could be achieved with the current plugin version by using some custom front-matter as well as custom Algolia index settings.

For example, you could add to every page you want featured a featured: true in the front-matter (every custom key of the front-matter is added to your records and can be used as part of your index settings).

Then, you would have to edit your _config.yml file to pass some custom Algolia settings to your index to tell it to give more weight to featured articles (more documentation).

The default settings for the custom ranking used by the plugin are defined here and use the date, weight of the header and position in the page by default. You can overwrite them in your _config.yml to also take the featured flag into account like this for example:

algolia:
  settings:
    customRanking:
      - desc(featured)
      - desc(date)
      - desc(custom_ranking.heading)
      - asc(custom_ranking.position)

This will put featured pages matching your keywords before other pages. You can use either boolean or numeric values for the customRanking and it will be taken into account. Note that the ranking in Algolia uses a tie-breaking algorithm when dealing with customRanking (written documentation, video) that might be a bit confusing at first if you're more used to coefficient based ranking.

Hope that helps :)

@idvorkin
Copy link
Author

idvorkin commented Aug 3, 2018

That's exactly what I'm looking for!! As an FYI, I couldn't figure this out from the documentation. The way you describe it is crystal clear.

@idvorkin idvorkin closed this as completed Aug 3, 2018
@pixelastic
Copy link
Collaborator

Thanks for the feedback. I'll add a note to add your question to the FAQ, then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants