Content
Use Content

Use Content

You can easily retrieve JSON data from your theme's content. By getting precise data, you can spontaneously use it for various purposes, such as building dynamic interfaces, integrating with external applications, or creating hassle-free setups.

If you want to access and use the content of your theme in JSON format, you can comply with the following lines of code:

Get JSON Data

⚠️

It will work only on Server Site Rendaring (SSR).

Single section

Use getMainPage() for any section data.

getMainPage(...path)

Example

import { getMainPage } from "@/lib/helper/contentConverter";
 
const hero = getMainPage("/heros/booking-hero.mdx");
 
Data Formate
{
  data: {
    title: 'Grab the proper <br> user gravity with Arolax',
    sub_title: 'Boost your productivity',
    description: 'Create tasks with various custom statuses to keep track of the progress of each why in the process whether you need a landing page for your business',
    image: '/assets/imgs/hero/booking/dashboard.png',
    action_btn1: { enable: true, label: 'Start free trial', link: '#' },
    action_btn2: { enable: true, label: 'Watch demo', link: '#' },
    shape1_img: '/assets/imgs/shape/shape-01.png',
    shape2_img: '/assets/imgs/shape/shape-02.png',
    shape3_img: '/assets/imgs/shape/shape-03.png',
    shape4_img: '/assets/imgs/shape/shape-04.png',
    shape5_img: '/assets/imgs/shape/shape-05.png',
    shape6_img: '/assets/imgs/shape/cube.png'
  },
  content: ''
}
 

Single page

Use getAllPages() for full page data.

getAllPages(...path)
⚠️

For path name, only use folder name inside content folder.

          • _index.mdx
          • a-insights-from-industry-leaders.mdx
  • getAllPages() function do not exicute if _ is used before file name.

    _index.mdx

    Example

    import { getAllPages } from "@/lib/helper/contentConverter";
     
    const blogs = getAllPages("blogs/main");