The one-page-flat-file CMS
JavaScript Python HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

One-Page Generator

OPgen is a small command line tool that can generate one-page websites (flat file). Organize your pages in separate files and OPgen will collect their content and insert them in your template (index.mustache).



  1. Clone this project where suiteable on your server.
  2. Run $ pip install pystache.
  3. That's it! Add your own pages to the pages directory and generate the website by calling $ python in your console. Use the flag -w if you want OPgen to automatically generate the website when you make an edit to your project.


Usage: python [<flags>]

  -h, --help           show this help message and exit
  --template=TEMPLATE  File to use as template [index.mustache]
  --file=FILE          Name of the generated file [index.html]
  --pages=PAGES        Directory where the pages are located [pages]
  -w, --watch          Start monitoring file changes and generate the one-page
                       html file on the fly

jQuery Events

Use the event pageChange or beforePageChange to detect when the visitor has navigated to a new page

$(window).on('pageChange', function(evt, page, args, section) {
    // new page is entered

The website will change to a "mobile" state when the window width is lower than 400px. Use the event viewModeChange to detect when this happens.

$(window).on('viewModeChange', function(evt, newMode) {
  // new mode will be either 'mobile' or 'desktop'

Set the js variable preventViewModeChange to false if you want to prevent the view-mode change entirely.