Insights into what moves us. Contributions from the Structr team and guests. The Structr Blog

Christian Morgner
03. October 2014

Our documentation is now hosted on GitHub!

As a part of the release of Structr 1.0 about a week ago, we have finally moved our documentation where it belongs: close to the code.

http://docs.structr.org now serves content from GitHub, which has several advantages:

  • the docs are now versioned along with the code
  • the documentation can be updated easily
  • users can contribute via GitHub pull requests

Technical aspects

The following simple set of template expressions allows us to fetch raw markdown content from GitHub and render it into HTML using Structr's built-in markdown renderer.

    store('version',
        if(gt(size(split(path_info, '/')), 2),
            nth(split(path_info, '/'), 1),
            'master'
        )
    )
    store('path',
        concat(
            'https://raw.githubusercontent.com/structr/structr/',
            retrieve('version'),
            '/docs/markdown/',
            page.name, '/',
            childsection.name,
            '.md'
        )
    )
store('content', GET(retrieve('path')))
if(empty(retrieve('content')), childsection.content, retrieve('content'))

More information

The above code snippets make use of built-in Structr UI functions which you can read more about at http://docs.structr.org/frontend-user-guide#Appendix B: Keywords and Functions