Sign in

output every blog post as json

  • This topic has 2 replies, 2 voices, and was last updated 1 year, 1 month ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #4173


    I’m trying to build a mongodb search engine of every post in a blog (roughly 800 posts). Is there a relatively easy way to do this? I’ve tried re-using some of the code which generates the feed.json file. I’ve also started down the path to use this templates,, to pull from the sqlite db to generate the json per post.

    Is there some easier way to accomplish the goal?


    Tomasz Dziuda


    My idea, but please remember – it is only idea, which wasn’t tested –

    1) create a custom post template
    2) create a new hidden post and assign this new custom post template

    3) then render the JSON in the template using @website.contentStructure global variable: and use feed-json.hbs as an inspiration

    Of course you will get JSON inside HTML file, but as I suppose – you just need raw JSON data.

    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!



    For now, I just use the JSON extension to sqlite3 and this query gets the core data into a usable format:

    SELECT title,, text, created_at FROM posts JOIN authors;

    Not quite as cool as running js templates, but gets the job done.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.