Hello,
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
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 https://github.com/alexadark/javierlorrente
and this is the blog Iâm transferring https://www.javierlorente.es/
as you can see there is no category prefix https://www.javierlorente.es/tecnologia/
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 https://share.getcloudapp.com/o0uvNloe
and did that https://share.getcloudapp.com/d5uWBkBw in frontity settings
now if I click on a category button from a post https://share.getcloudapp.com/p9uPpynX it works, but it doesnât work on the menu, even if the resulting urls are the same as shown here https://share.getcloudapp.com/P8ue01Xy
@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:
- Why is it working on client-side rendering? Maybe itâs related with this: https://github.com/frontity/frontity/issues/366
- A possible workaround for this until we release source v2?
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.
Hi again, @alexaspalato
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.
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!