flowershow icon indicating copy to clipboard operation
flowershow copied to clipboard

Tutorial: Custom page types and layouts

Open olayway opened this issue 2 years ago • 4 comments

This is the tutorial subject that won in our latest Discord poll.

image

Acceptance

  • [x] tutorial copy written, that covers:
    • [x] how to create custom Contentlayer document types (e.g. Recipe for sb writing a cooking blog, or Review for sb writing book reviews etc.)
    • [x] how to create a layout and use it for the custom document type Currently getting errors when using a symlinked component
    • [x] (bonus:) how to create a home page for listing all the pages of the custom type
      • we can just use our BlogsList component (which btw should be renamed to sth more generic)
  • [x] posted in our docs
    • [x] link to it added in our docs index page
  • [ ] posted in dev.to
  • [x] posted on reddit here
  • [x] announced on our Discord channel Done here
  • [ ] short email about it sent out to subscribers

Notes

  • We should probably export our Avatar component from core so users can use it in their own custom layouts
  • Rename Bloglist to something more generic like List or IndexList

olayway avatar Feb 14 '23 12:02 olayway

@khalilcodes @olayway I assume when a user wants to create a custom layout, they have to do that outside .flowershow and create a symlink in eg. .flowershow/layouts/custom , otherwise if they want to upgrade flowershow by reinstalling with npx flowershow@latest install , they will lose their custom components.

Creating a custom layout component in .flowershow/layouts seems to work as expected when used. But I am getting an error when trying to use a symlinked layout component like the error below:

image

So just using a non symlinked component for the tutorial for now

PhilippeduPreez avatar Feb 23 '23 18:02 PhilippeduPreez

@PhilippeduPreez I think for now it's ok to add the custom layout to .flowershow/layouts. The user will have to mess around with .flowershow/contentlayer.config.ts file anyway. We'll worry about the upgradeability problem later on.

olayway avatar Feb 27 '23 09:02 olayway

@PhilippeduPreez I've also created this issue about warning users about potentially losing custom stuff after re-running install command #444

olayway avatar Feb 27 '23 09:02 olayway

@PhilippeduPreez let me know if you need any help with the copy! 😊

olayway avatar Mar 01 '23 11:03 olayway