Skip to content

Commit

Permalink
fix: Blog pagination / Blog category listing (#6113)
Browse files Browse the repository at this point in the history
  • Loading branch information
canerakdas authored Nov 14, 2023
1 parent a5a3815 commit c7291c8
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion components/withLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { LegacyLayouts } from '@/types';
const layoutComponents = {
'docs.hbs': DocsLayout,
'about.hbs': AboutLayout,
'blog-categpry.hbs': BlogCategoryLayout,
'blog-category.hbs': BlogCategoryLayout,
'blog-post.hbs': BlogPostLayout,
'contribute.hbs': ContributeLayout,
'download.hbs': DownloadLayout,
Expand Down
8 changes: 4 additions & 4 deletions hooks/useBaseBlogData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export const useBaseBlogData = (pathname: string) => {
};

const currentCategory = useMemo(() => {
// We split the pathname to retrieve the blog category from it
// since the URL is usually /{languageCode}/blog/{category}
// the third path piece is usually the category name
const [, _pathname, category] = pathname.split('/');
// We split the pathname to retrieve the blog category from it since the
// URL is usually blog/{category} the second path piece is usually the
// category name
const [_pathname, category] = pathname.split('/');

if (_pathname === 'blog' && category && category.length) {
return category;
Expand Down
2 changes: 1 addition & 1 deletion pages/en/blog/advisory-board/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Advisory Board
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/announcements/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Announcements
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/community/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Community
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/feature/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Features
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: News
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/module/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Modules
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/npm/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: NPM
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/pagination.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: News from
layout: blog-categpry.hbs
layout: blog-category.hbs
author: The Node.js Project
---
2 changes: 1 addition & 1 deletion pages/en/blog/release/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Releases
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/uncategorized/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Uncategorized
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/video/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Videos
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/vulnerability/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Vulnerabilities
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion pages/en/blog/weekly-updates/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Weekly Updates
layout: blog-categpry.hbs
layout: blog-category.hbs
---
2 changes: 1 addition & 1 deletion types/layouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export type LegacyLayouts =
| 'about.hbs'
| 'learn.hbs'
| 'blog-categpry.hbs'
| 'blog-category.hbs'
| 'blog-post.hbs'
| 'contribute.hbs'
| 'index.hbs'
Expand Down

0 comments on commit c7291c8

Please sign in to comment.