Hi, i am trying to make Frontpage in Frontity js code. I registered custom api route which is featured-posts it show featured-posts with meta key. I am done with show post title image and link. But when click on link it redirect to 404 same post under category when click on that it show post content. Can you help me, i don’t know where i missed.
import { connect, decode, styled } from "frontity";
import { Fragment, useEffect } from "react";
import Link from "../link";
import Post from "../post";
const FeaturedPosts = ({ state, showExcerpt, showMedia }) => {
const posts = state.source.get("getFeaturedPosts");
//console.log(posts);
const { primary } = state.theme.colors;
const _showExcerpt = showExcerpt || !state.theme.showAllContentOnArchive;
useEffect(() => {
Post.preload();
}, []);
return (
<>
<Container>
{posts.items.map((item, index) => {
console.log(item.type +':'+ item.id);
const isLastArticle = index === posts.items.length - 1;
const data = state.source[item.type][item.id];
// console.log(item);
if(index == 1){
return (
<Fragment key={item.id}>
<LeftCol key={item.id}>
<Link link={item.link}>{item.title.rendered}</Link>
</LeftCol></Fragment>
);
}
})}
</Container>
</>
);
};
export default connect(FeaturedPosts);
const LeftCol = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 8rem);
font-size: 1.3em;
font-weight: 700;
`;
const Container = styled.div`
font-size: 1em;
font-weight: 600;
margin: 0 auto;
line-height: 30px;
width: calc(100% - 4rem);
max-width: 1170px;
@media (min-width: 700px) {
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 8rem);
font-size: 1.3em;
font-weight: 700;
}
`;