Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ui/src/helpers/startsWith.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict'

module.exports = (text, prefix) => typeof text === 'string' && text.startsWith(prefix)
8 changes: 8 additions & 0 deletions ui/src/partials/article.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<article class="doc"
{{! Concept pages explain what many operator pages repeat, so they should rank above those copies}}
{{#if (eq page.module "concepts")}}
data-pagefind-weight="3"
{{/if}}
{{! ADRs record past decisions, so they should not outrank the docs describing the current state}}
{{#if (and (eq page.module "contributor") (startsWith page.relativeSrcPath "adr/"))}}
data-pagefind-weight="0.1"
{{/if}}
{{! Only pages that are 'latest' or unversioned are included in the pagefind search}}
{{#if page.latest}}
{{#if (eq page.displayVersion page.latest.displayVersion)}}
Expand Down
5 changes: 4 additions & 1 deletion ui/src/partials/footer-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
// customized rank tuning - see https://pagefind.app/docs/ranking/
ranking: {
termSaturation: 0.4,
termSimilarity: 10.0
termSimilarity: 10.0,
// Operator pages often repeat a concept page's title on a much shorter page;
// the default 0.75 lets those short copies outrank the concept page.
pageLength: 0.25
}});
instance.add(new PagefindModularUI.Input({
containerElement: "#search-input"
Expand Down