I’m new to Frontity and trying to learn what is happening, but am having a hard time finding my way. I know once I have a better understanding I can start rolling the ball.
The theme I’m trying to edit is Frontity Chakra Theme.
I want to control which three posts show on the homepage, and possibly get rid of the latest posts section below the fold and replace it with something else.
You can see a demo of the theme here:
And the code can be found here:
How can I manually set which three posts show above the fold? Thanks for any/all direction!
You’re jumping in at the deep end . Chakra theme is quite a complex theme, so if you’re having a hard time finding your way around it might be an idea to start with mars-theme, say, and get to understand some of the concepts surrounding Frontity by experimenting with that, before moving on to Chakra theme.
One possible approach you could take would be to create a component for the homepage and display it conditionally if isHome is true.
If the three posts that you want to display are not in the ten most recent posts (which are fetched by default) then you will probably need to create a beforeSSR function to fetch them.
As I said earlier, if you’re new to Frontity it might be worth doing this as a P.O.C. in mars-theme, and then reimplement it in Chakra based on your learnings. Up to you.
I’ll keep Mars Theme close to study and see if I can break through on this custom REST call. I’ll also be sure to come back once I have a better understanding of beforeSSR and update you on my progress.
Awesome work, thanks for those. Great to see you contributing so enthusiastically to the community. Look forward to seeing what else you’re able to offer, and to seeing the results of your own projects.
In tonight’s update I’ve added custom CSS copied from the a 3rd party plugin into the chakra theme. Commits attached to issue show the code changes:
I added a way to make the homepage show the contents of a single page rather than the latest posts:
I finally pushed the updated chakra theme live (was running the mars theme).
If anyone would like to see the results of the work so far, I’d love for you to check it out (I still need to work on setting up og:tags and a rich snippet for embeds). I’ll create a new thread too in the Showcases section later:
Without even optimizing my images the site is scoring a 99% on GTMetrix:
I was having trouble with dependencies of the Chakra UI package not seeming want to support the latest version of React and this was effecting my npm install attempts.
I also renamed frontity chakra theme to forgepress theme in this latest commit, which was something I wanted to do.
So forgepress-theme is effectively now a fork of frontity-chakra-theme, yes? Have you considered uploading it to npmjs.com, so Frontity devs can install it with npm i forgepress-theme?
100% yes, but still a handful of things to do. Like figure out the open graph stuff. I’m having fatals when I follow the docs. I think, maybe in a month or so, I’ll tackle publishing to the npm.
We did something similar I also updated the Chakra theme to the latest version and made a pull request to their repo.
I took a quick look at your repo and the only minor thing I’d like to mention is in this file: https://github.com/ForgePress/ForgePress/blob/develop/package.json
You have a dependency of "react-spring": "^8.0.27". You might find it easier to use react-framer with Chakra as it is already dependent on it.
I have been setting up this theme, and its going great, but I have encoutered the same issues you have it seems. Yes, I want to pull in the menu set by wordpress. I have got this working with mars theme, but the setup here is a lot more complicated. any help?
other thing is the posts that are featured, I too would like to pull in posts from a specific category (this is how things are set up on my source site) did you get this working?
Final things are niggles- on the home page, below the featured posts we get shown 7 more posts. this is not great, i would like more, and set at an even number! where is the control for this? I have dug around and cant find it anywhere. ie. the equivalent of posts per page…?
But also the ‘more posts’ link just takes you to page 2 then stops. thats not ideal either, it should work as per the category pages I think, not clear why the theme dev did things that way.
anyway, things are working for me just need to wrap my head around the code, which is kinda nightmarish…