Why a static HTML generator
Before we start working on more advanced features like push notifications and iCal exports etc, we have been working on getting a generator (a simple node.js script) up, that can take data for an event either in form of json files, or from a given API in open-event data format, and generate a schedule page.
It has been used to generate the programm page of OpenTechSummit 2016 (http://2016.opentechsummit.net/programm/)
It is based on the open-event-scraper project of FOSSASIA, and some more features had been added when developing it for OTS16. Some of the new features include –
- Ability to define copyright and license in the API/Json, and generator adds it in the footer
- Ability to define sponsors (support for upto 3 levels are there), and the generator adds sponsor logos with links at the bottom of the page.
- Ability to embed audio, slides and videos into the session cards.
How the process works
Right now if you take a look at the open-event-scraper project under opentechsummit (which is a fork from the FOSSASIA repo, and being used to develop the new features) , you’ll see the process goes like this –
- The scraper.py file scrapes data about sessions and speakers from an internal Google Sheet we have. Then the event.py file gets data about the event itself (copyright, links to social channels).
This step is not needed if we are using a JSON API endpoint. This is needed only if the data source is a Google Sheet, then local JSON files are created.
- Once we have an endpoint or JSON files locally downloaded, there a node.js script – generator.js which generates a static HTML page.
- The generated HTML page is based on a handelbars template – schedule.tpl where all the required markup is there.
- And finally there is our own stylesheet which is called schedule.css and is a very lightweight styling addition, on top of what is majorly a vanilla bootstrap layout.
The road ahead
Going forward we will pull back in this source code to our main repo https://github.com/fossasia/open-event-webapp .
Then we’ll add some parameters that can be fed to generator.js when calling it, like –
- Name of event
- Color scheme
- URL of endpoints
This will have a minimal form-like frontend
We can host this on heroku then, where filling the form, will run the generator.js and the generated HTML and associated CSS files will be available as a zip.
You must log in to post a comment.
This Post Has One Comment
Pingback: Sending a streaming zip file in node.js – opev