I’ve defined a Homepage in Wordpress (Settings > Reading > Homepage). The URL of this page is “/” and I’ve added content to it.
Now I am trying to fetch the content of that page in Frontity. However, when I am at localhost:3000 this
state.source.get(state.router.link)
gives me as result the type: “post”. Which means I get just the posts from Wordpress. I do not get the content of that Wordpress page.
Any hint would be great
Hi @nerdess, welcome!
You need to set the homepage slug in wp-source in the frontity-settings.js
file, as an example, here is one of the pages I’m working on:
"name": "@frontity/wp-source",
"state": {
"source": {
"url": "https://backend.mintmedia.no",
"homepage": "/hjem",
}
}
And also be aware that the homepage has a slug, so the name om my homepage is ‘Hjem’, so therefore the slug is ‘hjem’.
hey @kasper, thx for the quick response
I do have the Homepage defined in frontity-settings.js. I also have a separate posts page defined and it is all in sync with the settings inside Wordpress.
My Homepage has no slug though since it sits at “/”.
So this does not seem to be the problem
Hi @nerdess
Try to change "homepage": "/",
to "homepage": "/home",
aha! that was the solution!
I assumed the homepage has no slug
1 Like
Great, that’s a very easy mistake to make. Good luck on the site!
Hi @nerdess
Welcome to the Community!!
Glad to read you were able to solve your issue!
Thanks @kasper for the help
For further reference, the package in charge of getting the data from WordPress is wp-source
. In its docs page you can find the details of these properties used to define a custom homepage:
1 Like
@nerdess by the way, the recommended way of setting the URL of WordPress is by setting the state.source.url
property
You can read more about this in our guide Setting the URL of the WordPress data source
As you can read in that page…
From version 1.10 of the @frontity/wp-source
package, the property state.source.api
should never be set manually by the end-users (it will be computed from the properties mentioned above)