Blog Templates
Within templates, the base theme includes two specific templates for the blog:blog-page.tsxblog-detail.tsx
Blog Content Model in Experro Admin
In the Admin panel, a workspace is already equipped with a pre-defined content model specifically designed for the blog section. This content model includes the necessary fields and configurations to manage and display the blog content effectively. To utilize the Blog page functionality in the base theme, you need to create a record in the Web-pages content model with a page-slug of/blog/.
This setup should align with the instructions and visual reference provided in the accompanying screenshots below.
Content Library > Blog Section
Content Model > Blog Section
In the pre-defined content model for the blog section in the Admin panel, there are two fields of the relation field type.These fields are:
- Author: This field allows you to associate a blog post with the author or creator of the post.
- Categories: This field allows you to assign one or multiple categories to a blog post, helping organize and classify the content.
Relation field for Categories Content Model
As shown in the above image, we can arrange the relationship between Category and Post to many-to-many relationship. This indicates that multiple blog posts can be associated with a single category, and a single blog post can be associated with multiple categories. It allows for a flexible and versatile categorization of blog posts based on various topics or themes.BlogPage Component
To access theblog template in the base-theme, you can navigate to the following directory structure.
blog-page(blog-page.tsx) template needs to be assigned to all the categories and author records in order to display the blog content correctly.
The blog-page template in the base theme contains a component that handles the listing of blog posts when the page assigned with the blog-page.
BlogListing Component
Theblog-page template in the base theme utilizes the ExpBlogListing component, which receives the pageData as a prop.
In the blog-listing component, there are two important functions that need to be considered for manipulating how the blog data is fetched and displayed on the blog-page template. These functions are responsible for fetching the blog data and c
Content Library > Blog Section
Content Model > Blog Section
In the pre-defined content model for the blog section in the Admin panel, there are two fields of the relation field type.These fields are: ontrolling its rendering on the page. By modifying these functions, you can customize the data you get from the Admin Panel.
For Blog-Detail page, template is already created in the the base theme, you need to use a template namedBlog-Detail Page
blog-detail.tsx. This template should be assigned to the records of the posts content model in the Experro Admin panel. This assignment will ensure that the blog-detail template is used to render the individual blog post pages.
For a better understanding of the implementation details, you can refer to the code in the base theme template directory. The code will provide more insights into how the Blog functionality is implemented.