Posts are not getting loaded in category pages

✓ Description of your issue
Whenever I open a category page, the empty page gets opened with no posts.

✓ System info → npx frontity info

## System:
 - OS: Windows 10 10.0.19042
 - CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
 - Memory: 2.04 GB / 7.81 GB
## Binaries:
 - Node: 14.15.1 - C:\Program Files\nodejs\node.EXE
 - npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
## Browsers:
 - Chrome: Not Found
 - Edge: Spartan (44.19041.423.0), Chromium (87.0.664.47)
 - Internet Explorer: 11.0.19041.1
## npmPackages:
 - @frontity/core: ^1.9.1 => 1.9.0 
 - @frontity/google-analytics: ^1.3.1 => 1.3.1 
 - @frontity/head-tags: ^1.0.8 => 1.0.7 (1.0.8)
 - @frontity/html2react: ^1.5.0 => 1.4.0 (1.5.0)
 - @frontity/tiny-router: ^1.2.3 => 1.2.2 
 - @frontity/wp-comments: ^0.2.4 => 0.2.4 
 - @frontity/wp-source: ^1.10.0 => 1.9.1 (1.10.0)
 - @frontity/yoast: ^2.0.1 => 2.0.1 
 - forgotten-developer: file:packages/forgotten-developer => 1.0.0 
 - frontity: ^1.13.0 => 1.12.0 (1.13.0)
 - prismjs: ^1.22.0 => 1.22.0 
 - react-icons: ^3.11.0 => 3.11.0 
 - yarn: ^1.22.10 => 1.22.10 
## npmGlobalPackages:
 - frontity: Not Found
 - npx: Not Found

✓ Specific errors you’re getting in the terminal
None

✓ Specific errors getting in the console when open category link from the navigation menu

capitalize.ts?adee:3 Uncaught (in promise) TypeError: Cannot read property 'split' of undefined
    at __webpack_exports__.default (capitalize.ts?adee:3)
    at Object.eval (postType.ts?e855:118)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (postType.ts:4)
    at _next (postType.ts:4)
    at eval (postType.ts:4)
    at new Promise (<anonymous>)
    at Object.eval (postType.ts:4)
    at Object.eval [as func] (postType.ts?e855:41)
    at eval (actions.ts?f1c8:88)

✓ if category link opened directly error in the console

Uncaught TypeError: this.remove is not a function
    at <anonymous>:12:14

✓ A repository or codesandbox with the code of your project
https://github.com/Divaksh/forgotten-developer/tree/master

✓ A deployed version of your site
http://divaksh.com/

✓ A category link where the empty posts are not getting displayed
https://divaksh.com/java/

✓ The URL of your WP REST API
https://api.divaksh.com/wp-json

Hi @Divaksh,

Are you using custom posts/categories? This issue seems to be related with this one

No, I’m not. I have just removed “category” from the URL using the option of Yoast SEO.

image

I added following in the state in the frontity.settings.js and it worked, thank you for pointing to me to the right direction. :slight_smile:

source: {
  url: "https://site.com/",
  categoryBase: "/"
},

As mentioned above, using the following solution is creating ambiguity and making all posts pages 404. Is there any way to remove the category slug?

source: {
  categoryBase: "/"
},

Hi @Divaksh,

In that case, I think this use case is not actually supported by wp-source package

But there’s a workaround you can use to solve this issue by using handlers. It’s explained here:

Hope this helps

I have implemented it and it works fine, thank you. :slight_smile:

1 Like