No prefix in categoryBase

I’m working on transferring an existing blog to frontity
in this blog the categoryBase is ‘.’ , but if in the menu I set for ex [“Tecnologia”, “/tecnologia”], it doesn’t work
it;s very strange as the link is the same and work normally
look at this

Hi @alexaspalato :blush:

Could you explain this issue in more detail? I’m not really understanding the problem

Also, if you could provide a repository with the code of your project, it would be easier for me to help you with your issue

If you can’t share your whole project, please create a CodeSandbox (you can start with this template) or a GitHub repository with the minimal amount of code to reproduce the issue.

Hey JuanMa, this is the repo
and this is the blog I’m transferring
as you can see there is no category prefix
as nothing was working from this because of numerous plugins
I have imported posts and pages to a clean local install and there I have configured permalinks like that
and did that in frontity settings
now if I click on a category button from a post it works, but it doesn’t work on the menu, even if the resulting urls are the same as shown here

@alexaspalato yes, the current version of wp-source supports changing the prefix of categories but not removing the prefix. We didn’t realize that this was possible in WordPress when we designed it. We are planning to solve it in source v2.

@david could you please investigate:

1 Like

Thank you, finally the client is ok with keeping a prefix for categories, but, yes I hope this will be fixed, my last client for example also removed the categorie’s prefix, and wanted to keeped like that to have the same url as is ancient site

Sure, I’ll take a look to this. :+1:

1 Like

Hi again, @alexaspalato :wave:

I wasn’t able to reproduce the same behaviour you got but certainly removing the category base is something that cause trouble in Frontity (there is a workaround though, check it out here).

When the @frontity/wp-source package was designed we didn’t know that you can get rid of the category base in WordPress setting a dot (.) in that field, so doing the same in Frontity doesn’t work. From the WordPress documentation:

The default values for these are category and tag. You can change them, but you can’t remove them from the URLs altogether.

Based on that, we created what we called handlers in wp-source, which are pieces of code that get each kind of entity (posts, pages, categories, etc.) from WordPress according to a link pattern. If the category base is removed from the link pattern of categories, then it is not possible to distinguish if the link corresponds to a category or a post.

Well, this is the default Frontity configuration, but we also designed Frontity to be hackable. :blush:

It is possible to remove the category base with the workaround I shared below, which consists basically in creating a new handler that will use the same link pattern for both categories and posts. Then you can set categoryBase: "" in your frontity settings and it should work.

Hope it helps!

1 Like