Intuitive, expansive and flexible creation with no distractions.
Robust, user-friendly data protection for your visitors and you.
Modern, effective solutions for site growth and functionality.
Professionally designed and coded themes and plugins.
Free and premium, beautifully-designed templates.
Expand your site with your favorite tools and apps.
Get help building your site from our web development services.
Learn how Publii works, from installation to creation.
Documentation, guides, and tutorials for developers.
Explore and interact with others and learn new things.
Dedicated customer support for paid products.
Read up on the latest news about Publii and its products.
Forum › General Inquiry
Hi,
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, https://github.com/GetPublii/Publii/blob/8db728c848a7c2e8c15770d1fd96e7e38304a8dd/app/default-files/theme-files/feed-json.hbs, to pull from the sqlite db to generate the json per post.
Is there some easier way to accomplish the goal?
Thanks!
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: https://getpublii.com/dev/website-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.
For now, I just use the JSON extension to sqlite3 and this query gets the core data into a usable format:
SELECT title, authors.name, text, created_at FROM posts JOIN authors;
Not quite as cool as running js templates, but gets the job done.