Skip to content

Added PostFeedLayout and PostCategoryLayout#64

Merged
TomasBankauskas merged 10 commits intomainfrom
post-feed-layout
Nov 30, 2021
Merged

Added PostFeedLayout and PostCategoryLayout#64
TomasBankauskas merged 10 commits intomainfrom
post-feed-layout

Conversation

@smnh
Copy link
Copy Markdown
Contributor

@smnh smnh commented Nov 17, 2021

Two new models and matching components:

  • PostFeedLayout
  • PostCategoryLayout

PostCategoryLayout extends the PostFeedLayout, both in model and in component. They are exactly the same. The difference is their urlPath that is configured in stackbit.yaml in nextjs-starter.

Related PRs:
stackbit/stackbit-nextjs-starter#21
stackbit/stackbit-content-packs#15

@smnh smnh requested a review from TomasBankauskas November 17, 2021 21:56
@netlify
Copy link
Copy Markdown

netlify bot commented Nov 17, 2021

✔️ Deploy Preview for stackbit-components ready!

🔨 Explore the source changes: 0750814

🔍 Inspect the deploy log: https://app.netlify.com/sites/stackbit-components/deploys/61a6858d35ea0f0008a448c7

😎 Browse the preview: https://deploy-preview-64--stackbit-components.netlify.app

Comment thread src/layouts/PostFeedLayout/index.tsx Outdated
);
}

function PageLinks({ pageIndex, baseUrlPath, numOfPages, numOfTotalItems }) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smnh I tested the pagination in Studio and it worked. Nice!

  • I tested changing the "Number of Posts per page" to 3 (of 4) and pagination just worked.
  • I tested adding new post pages and they worked.

@JugglerX
Copy link
Copy Markdown
Contributor

@smnh @TomasBankauskas couple of missing pieces?

  • Do we need to add the category links to the posts?
  • I noticed the PostLayout does not display the image @TomasBankauskas

Also see my comment in the content pack PR about category pages being empty and some other issues stackbit/stackbit-content-packs#15 (comment) @smnh

@smnh
Copy link
Copy Markdown
Contributor Author

smnh commented Nov 22, 2021

  • Do we need to add the category links to the posts?

You mean from UI perspective, yes. Any post that has a category, should show a link to that category.
How links work?
@JugglerX @TomasBankauskas, right now we have a utility function in components that resolves object file path to page path. No more, with this PR in nextjs-starter, every page will have __metadata.urlPath. So no need to call getPageUrlPath anymore.
For example, a blog post that shows category simply uses its __metadata to render the link:

<Link href={category.__metadata.pageUrl}>{category.title}</Link>

@smnh smnh force-pushed the post-feed-layout branch 2 times, most recently from e8b2f2d to f8d71fa Compare November 24, 2021 20:15
@smnh smnh force-pushed the post-feed-layout branch 3 times, most recently from 8bd04ac to 5bf6434 Compare November 25, 2021 22:57
@TomasBankauskas TomasBankauskas merged commit f013f07 into main Nov 30, 2021
@TomasBankauskas TomasBankauskas deleted the post-feed-layout branch November 30, 2021 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants