Skip to main content
The base theme enables you to host and manage a dedicated blog section, where you can effortlessly write, publish, and share articles, news, and other informative content. It comes with default support to host the blog for your web application.

Blog Templates

Within templates, the base theme includes two specific templates for the blog:
  • blog-page.tsx
  • blog-detail.tsx
You will get a field called a relation field that will enable you to establish relationships between two blog content models created in the Admin Panel. This field enables various types of relations, such as many-to-many, one-to-many, many-to-one and one-to-one.

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.
image.png image.png Once you have a clear understanding of the Blog functionality in the base theme, you can make any necessary modifications to suit your specific requirements.

Content Library > Blog Section

image.png

Content Model > Blog Section

image.png 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:
  1. Author: This field allows you to associate a blog post with the author or creator of the post.
  2. Categories: This field allows you to assign one or multiple categories to a blog post, helping organize and classify the content.
image.png

Relation field for Categories Content Model

image.png 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. image.png image.png

BlogPage Component

To access the blog template in the base-theme, you can navigate to the following directory structure.
In the Admin Panel, the 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. image.png 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

The blog-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

image.png

Content Model > Blog Section

image.png 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.

Blog-Detail Page

For Blog-Detail page, template is already created in the the base theme, you need to use a template named 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.