Generate JSON data page in Jekyll

Asked

Viewed 33 times

0

I wonder if there is any way to generate a page with data on JSON (false data) in the Jekyll.

The intention is to simulate a request AJAX for that page already preparing the code for when the data is generated by the platform coming from a real database.

1 answer

0

After some time of research I discovered the data files from Jekyll, at first I thought it was possible to read that data only through templates liquid, but after doing some tests I noticed that the folder _data/ is also sent to the _site/ after the code is compiled.

So just make a request for the file created inside the folder _data/

Example:

$.get('data/example.json', function(data) {
    console.info(data);
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.