General instructions
To create a local blog with the Shaker's Kit, you need to follow these steps:
- Create a file with the
.mdx
extension in thecontent
directory. The file name will be the slug for the post. - Write the desired content in the file.
- Use the
frontMatter
in the very beginning of the file to set the metadata for the post.
- Use the
title
property to set the name for the post. - Use the
publishedDate
property to set the publication date for the post. By default the blog posts with the future date will not be displayed on the blogs page. - Use the
summary
property to set a summary for the post.
- Each blog post required a cover image. The cover image should be placed in the
public/static/images/blog/[blog-name]
directory. The image name should becover.png
. To modify this behavior refer to thecontent-collections.ts
file. - Done! You can navigate to the
/blog/[filename]
page to see the newly created blog post.
Available Components
In addition to the markdown components, the Shaker's Kit also provides the following components:
- Code blocks with the syntax highlighting powered by Shiki.
<Image />
: React component for displaying images with the Next.js image optimization.<Video />
: React component for displaying videos.
Down below you will find examples of how to use these components.
You can extend the components by adding new to the src/components/MDXComponents.tsx
file.
In addition, every heading as H1, H2, H3, H4, H5, H6 will be automatically converted to a link and will be accessible via the table of contents.
Image
In addition to the local images you can also use any accessible image from the internet.
Video
In addition, local videos can be used as well.
Code
Simple example
Line highlighting example
Block highlighting example
Known issues
If the blog post file contains a syntax error, the error will be thrown in the console and the page will not be rendered.
One of the error examples - Cannot destructure property 'fields' of 'undefined' as it is undefined.