Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2022-09-07 17:52:04 +0300
committerSarah German <sgerman@gitlab.com>2022-09-07 23:52:45 +0300
commit526007f66d95fdf19babc3fadc072f41a034df1c (patch)
tree7c91b7a88a7277c03e20eaa33fe86fcd5faf101e
parent2f3f20dda5364ba9695e12054a5a93490c000784 (diff)
Adjust level function
-rw-r--r--lib/helpers/algolia_rank.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/helpers/algolia_rank.rb b/lib/helpers/algolia_rank.rb
index bfe1ede1..3e14f0d7 100644
--- a/lib/helpers/algolia_rank.rb
+++ b/lib/helpers/algolia_rank.rb
@@ -38,7 +38,12 @@ module Nanoc::Helpers
# We use this on Algolia to increase relevance of higher-level pages.
###
def algolia_level(item)
- return item.identifier.to_s.scan("/").count
+ path = item.identifier.to_s
+ level = path.scan("/").count
+ if path.include? "index.md"
+ level -= 1
+ end
+ return level
end
end