Returns 404 even with matched routes

I got no errors in terminal, its a fresh theme only edited the config.js file to match routes and to point source to my wordpress.

Every page returns 404, why does that happen?
Here is my config:

const settings = {

  name: "example",

  state: {

    frontity: {

      url: "https://test.frontity.org",

      title: "Test Frontity Blog",

      description: "WordPress installation for Frontity development",

    },

  },

  packages: [

    {

      name: "@frontity/mars-theme",

      state: {

        theme: {

          menu: [

            ["Home", "/"],

            ["Blog", "/blog/"],

            ["About Us", "/about/"],

          ],

          featured: {

            showOnList: false,

            showOnPost: false,

          },

        },

      },

    },

    {

      name: "@frontity/wp-source",

      state: {

        source: {

          url: "https://dariokolic.com/wp-json",

        },

      },

    },

    "@frontity/tiny-router",

    "@frontity/html2react",

  ],

};

export default settings;

I am not using Vercel but Node.js Server on a hosting, even locally I get the 404 on pages.

Here is the frontity live: https://frontity.dariokolic.com/
Wordpress: https://dariokolic.com/

Hi @coachbuilds

The value of state.source.url should not have the wp-json part. I should just be as follows:

{
   name: "@frontity/wp-source",
   state: {
      source: {
         url: "https://dariokolic.com/,
       },
   },
},

See our docs here.

Hope this helps and that it resolves your issue.

Thank you I noticed that, I put both url and api keys-value pairs in there and it works.

Another question is what is the difference between url and api?
Can I use Wordpress plugins with the api?

api requires the wp-json part and is an older spec. url is the newer version and takes just the URL without the wp-json part. You only need one, not both.

You can use WordPress plugins so long as they add their data to the REST API. If the plugin you’re using does not add data to the REST API you may be able to add it yourself with a small amount of PHP code. See here for more info.

1 Like