Skip to content
Merged
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
19 changes: 11 additions & 8 deletions src/utils/algolia.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const processMdxEntry = ({ children: [entry] }) => {
fileAbsolutePath,
mdxAST,
objectID,
frontmatter: { title, redirect },
frontmatter: { title, redirect, slug: customSlug },
} = entry;
if (redirect) {
// avoid pushing empty records
Expand All @@ -41,13 +41,15 @@ const processMdxEntry = ({ children: [entry] }) => {
.slice(0, -1)
.join('/');
const path = `/${cutStrippedDirectory}/${title.replace(/\//g, '-')}`;
const slug = compose(
noTrailingSlash,
dedupePath,
removeGuidesAndRedirectWelcome,
unorderify,
slugify,
)(path);
const slug =
customSlug ||
compose(
noTrailingSlash,
dedupePath,
removeGuidesAndRedirectWelcome,
unorderify,
slugify,
)(path);
const chunks = chunk(mdxAstToPlainText(mdxAST), 300);
let pointer = chunks.length;
const cache = new Array(pointer);
Expand Down Expand Up @@ -86,6 +88,7 @@ const docPagesQuery = `{
frontmatter {
title
redirect
slug
}
mdxAST
fileAbsolutePath
Expand Down