Setup backend

Once enabled and authorized, Troglio will prompt for the destination of your pages.

Troglio creates pages data in JSON format, ready to be consumed by templates or any kind of framework (React.js, Vue.js, Angular.js, Hugo, Jekyll...). Troglio assumes you have an existing back-end supporting your app or website's assets, usually in some versioning system like Git. Troglio conveniently allows you to connect with big Git players Github, Gitlab and Bitbucket. In case you don't use one of these, no worries: just provide Troglio with a valid endpoint accepting POST data in JSON format.

Panel asking where to send pages data to Pick pages destination

This panel should be straightforward, just follow the steps until you connect either a Git provider hosting your app/websites assets, or a custom URL pointing to a back-end you own..

Considerations to keep in mind depending on where your back-end lives:

  • For Git endpoints: each time content is published, Troglio will send data as a classic commit command upserting a file in the master branch at /troglio/data.json. UPSERTING means it will create or update the relevant file automatically. Also, data are always refreshed without any incremental steps whatsoever: new data replace old ones. Simple. Just to make it clear again: there will be a classic commit each time a user presses the Publish ! button, so if you work with your repo from a remote source, do not forget to sync changes using git pull origin before pushing changes yourself.

  • For custom endpoints: Troglio will issue a POST request to the provided URL, with data included as JSON. So prepare your back-end to receive these data and do something with it. We created an example project on Glitch for you to get started here.

Implementation ideas

Using git providers there is always a free Continuous Integration pipeline available to trigger a build when a new commit happens. This is how this very website works:

  • We manage content into Trello cards from our smartphone
  • Then we click the Publish ! button
  • Troglio builds data and send them by committing to a private Git repo
  • Our git repo is configured to send a webhook to Netlify at each commits
  • Netlify triggers a new build with relevant build parameters
  • The site builds within some seconds
  • After build, Netlify deploys new pages through their CDN
  • Changes are live all around the world

But there is another way. This solution fits well for static websites like, but not always for apps. In that case, or just because of personal taste, one can also leverage Git CI pipelines to create their own API. The workflow could be as follow:

  • Manage content in Trello
  • Click the Publish ! button
  • Troglio commits to a given Git repo
  • The pipeline is configured to read the file at troglio/data.json, then parse its JSON content
  • Reminding that the final URL of each page is available in the path property, we can then create a new page for each object in the pages array
  • Then deploy each page using an application/json MIME type

With this workflow, one will be able to query pages data like a classic API.

For other more complex projects needing filters, databases etc... we recommend switching to a more flexible custom back-end like node.js or any other language, and create a web server accepting POST requests with JSON data as input. Then the world is yours: Troglio will send data to your endpoint and you can do virtually anything with it to process, store, and retrieve data as you please.