Homepage at "/" is of type "post" instead of type "page"?!?

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 :slight_smile:

Bildschirmfoto 2021-03-10 um 11.14.41

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 :blush:

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.

Bildschirmfoto 2021-03-10 um 12.26.41

My Homepage has no slug though since it sits at “/”.

Bildschirmfoto 2021-03-10 um 12.27.03

So this does not seem to be the problem :thinking:

Hi @nerdess

Try to change "homepage": "/", to "homepage": "/home",

aha! that was the solution!

I assumed the homepage has no slug :face_with_hand_over_mouth:

1 Like

Great, that’s a very easy mistake to make. Good luck on the site! :smiley:

Hi @nerdess

Welcome to the Community!!

Glad to read you were able to solve your issue! :blush:

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)