The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
I have a (hopefully) simple question. I’m just wondering how I can create static routes on Frontity that don’t fetch information from WP-JSON.
I’ve seen some posts about adding a static homepage, but I haven’t found anything relating to other routes that are static. I just want something like an About page where the content of it is hard-coded and not fetched from WordPress. Is there a way I can do this? Thank you!
mburridge2
Hi @Arepo
If I understand your question correctly I think you could create a component, say <About> in about.js with the content hard-coded in the return statement.
import React from "react";
const About = () => {
return (
<div>
<h2>About</h2>
<p>The hard-coded about page content</p>
</div>
)
}
export default About
Note that because the content is hard coded there’s no need to connect this component to the state.
Then import the component into index.js and load it if state.router.link is /about/:
import About from "./about"
const Root = ({ state }) => {
// ...
<Switch>
// ...
<About when={state.router.link == '/about/'} />
// ...
</Switch>
// ...
}