Skip to content

Commit 4487b86

Browse files
revert gatby node changes and fix
Signed-off-by: Rajesh-Nagarajan-11 <rajeshnagarajan36@gmail.com>
1 parent ab1736a commit 4487b86

2 files changed

Lines changed: 15 additions & 29 deletions

File tree

gatsby-node.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -469,30 +469,13 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
469469
}
470470

471471
handbook.forEach((page) => {
472-
let finalSlug = page.fields.slug;
473-
// Strip `.html` for production builds so client-side router matches clean paths
474-
if (process.env.NODE_ENV === "production") {
475-
finalSlug = finalSlug.replace(/\.html$/, "");
476-
}
477-
478472
envCreatePage({
479-
path: finalSlug,
473+
path: page.fields.slug,
480474
component: `${HandbookTemplate}?__contentFilePath=${page.internal.contentFilePath}`,
481475
context: {
482-
slug: finalSlug,
476+
slug: page.fields.slug,
483477
},
484478
});
485-
486-
// If the source slug contained .html, create a redirect so .html URLs still resolve
487-
if (finalSlug !== page.fields.slug) {
488-
createRedirect({
489-
fromPath: page.fields.slug,
490-
toPath: finalSlug,
491-
isPermanent: true,
492-
redirectInBrowser: true,
493-
force: true,
494-
});
495-
}
496479
});
497480

498481

src/sections/Community/Handbook/handbook-single/HandbookTOC.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,19 @@ const HandbookTOC = ({ pages, currentSlug }) => {
3535
</div>
3636
<div className="toc-list">
3737
<ul className={`toc-ul ${expand ? "toc-ul-open" : ""}`}>
38-
{pages.map((page, index) => (
39-
<li key={index}>
40-
<Link
41-
to={page.fields.slug}
42-
className={`toc-sub-heading toc-sub-inline${page.fields.slug === currentSlug ? " active" : ""}`}
43-
>
44-
{page.frontmatter.title}
45-
</Link>
46-
</li>
47-
))}
38+
{pages.map((page, index) => {
39+
const slug = `${page.fields.slug}.html`;
40+
return (
41+
<li key={index}>
42+
<Link
43+
to={slug}
44+
className={`toc-sub-heading toc-sub-inline${page.fields.slug === currentSlug ? " active" : ""}`}
45+
>
46+
{page.frontmatter.title}
47+
</Link>
48+
</li>
49+
);
50+
})}
4851
</ul>
4952
</div>
5053
</TOCWrapper>

0 commit comments

Comments
 (0)