Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overwrite to category view #535

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ apps:
category:
isEnabled: true
pathname: 'category' # Category main path /category/some-category, you can change this to "group" (/group/some-category)
postsPerPage: 8
robots:
index: true

Expand Down
3 changes: 2 additions & 1 deletion src/utils/blog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const blogCategoryRobots = APP_BLOG.category.robots;
export const blogTagRobots = APP_BLOG.tag.robots;

export const blogPostsPerPage = APP_BLOG?.postsPerPage;
export const categoryBlogPostsPerPage = APP_BLOG?.category.postsPerPage;

/** */
export const fetchPosts = async (): Promise<Array<Post>> => {
Expand Down Expand Up @@ -210,7 +211,7 @@ export const getStaticPathsBlogCategory = async ({ paginate }: { paginate: Pagin
posts.filter((post) => post.category?.slug && categorySlug === post.category?.slug),
{
params: { category: categorySlug, blog: CATEGORY_BASE || undefined },
pageSize: blogPostsPerPage,
pageSize: categoryBlogPostsPerPage || blogPostsPerPage,
props: { category: categories[categorySlug] },
}
)
Expand Down