diff options
author | Sarah German <sgerman@gitlab.com> | 2022-09-07 17:52:04 +0300 |
---|---|---|
committer | Sarah German <sgerman@gitlab.com> | 2022-09-07 23:52:45 +0300 |
commit | 526007f66d95fdf19babc3fadc072f41a034df1c (patch) | |
tree | 7c91b7a88a7277c03e20eaa33fe86fcd5faf101e | |
parent | 2f3f20dda5364ba9695e12054a5a93490c000784 (diff) |
Adjust level function
-rw-r--r-- | lib/helpers/algolia_rank.rb | 7 |
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 |