Hi,
Iāve just migrated my regular WP site to an AWS+Vercel hosted Frontity site and it was mostly a smooth process (great Tutorial by the way, Frontity team!).
However, I canāt seem to navigate to my category pages. They return a 404.
I canāt share my code as itās not in a repository yet, but Iām just using the twenty-twenty theme provided by Frontity. No modifications made.
Site is here: https://www.robcallaghan.co.uk/
WP source/ API is here: https://wp.robcallaghan.co.uk/
I see an error in the console regarding a string being āsplitā but Iām not sure if this is related.
Any ideas?
Thanks in advance.
Hi @rob_cal_uk
Welcome to the Frontity community.
Did this work for you in your dev environment? Iāve set up an unmodified twentytwenty-theme locally and I canāt access any categories from your endpoint. I also get the āsplitā error in the console.
What permalink settings are you using in WordPress? What happens if you try changing them?
Hi @mburridge - thanks for replying.
It didnāt / doesnāt work in my dev environment (which still pulls from the live WP site) and even with a different theme.
See permalink settings below:
Iāve just changed the category base from empty to āblogā and then to ātopicsā and neither worked.
Hi @rob_cal_uk
What happens if you use a setting other than Custom Structure
, e.g. Post name
?
@mburridge I changed it to just the post name and it works. Great! But sadly not ideal.
To confirm, I changed it back to the Custom version (posts prepended with /blog) and the category archive pages stopped working again.
Any ideas whatās going on?
hi @rob_cal_uk
Have you changed the category base
setting in Settings
āPermalinks
?
Hi @mburridge
Changing the category base to blog results in a 404 too.
Iāve always been able to see the categories in the state (perhaps you have also) - screenshot below - so I donāt understand why the app cannot display them.
Shall I report this as a bug somewhere - or is there more exploration to do?
Hi @rob_cal_uk
Try using the āPost nameā permalink setting, but with āblogā in the āCategory baseā. What happens then?
It looks like that for categories isFetching
remains true
, and isReady
remains false
implying that nothing is coming back from the endpoint for that route.
@mburridge No luck, Iām afraid! Still returning 404sā¦
Hi @rob_cal_uk
Hmm . Can you create a repository and post a link here. Iāll clone it locally and try to see whatās going on.
Hi @rob_cal_uk
Iāve cloned your repo and managed to get it working.
Try adding a categoryBase
property to the wp-source
settings in frontity.settings.js
.
{
"name": "@frontity/wp-source",
"state": {
"source": {
"url": "https://wp.robcallaghan.co.uk",
"categoryBase": "/blog/category"
}
}
}
The value here will be what you define in Settings
ā Permalinks
ā Category base
in the WordPress admin.
Let me know how you get on. For more info see here.
Thank you @mburridge - works perfectly.
Do you know if the issue was that the base URL for category pages wasnāt defined at all, or that thereās a default set for the categoryBase value which didnāt match my specific setup?
Hi @rob_cal_uk
There isnāt a default for categoryBase
. If you leave it out of your configuration in frontity.settings.js
and look at the state youāll see that itās just an empty string. I think the problem was that you had the Category base
set in the WP admin, so you also needed it in your Frontity configuration.
Iām glad you managed to get it working.