Skip to content

Commit

Permalink
tweak transformItems
Browse files Browse the repository at this point in the history
  • Loading branch information
agordn52 committed Jan 18, 2024
1 parent abbdab0 commit 2ddb86b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions resources/views/layouts/app-docs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,20 @@ class="absolute font-normal bg-white shadow overflow-hidden rounded w-24 border
indexName: '{!! config("project.meta.algolia_index_name") !!}',
insights: true,
container: '#search',
transformItems(items) {
return items.map((item) => {
var sectionName = item.hierarchy.lvl2;
if (sectionName == null || sectionName == "") return;
var sectionId = sectionName.toLowerCase().replace(' ', '-');
// remove old anchor
item.url = item.url.replace(/#.*$/, '');
item.url = item.url + '#' + sectionId;
return item;
});
},
recordExtractor: ({ helpers }) => {
return helpers.docsearch({
recordProps: {
Expand Down

0 comments on commit 2ddb86b

Please sign in to comment.