def setup(app):
    """Called by Sphinx during phase 0 (initialization).

    :param app: Sphinx application object.

    :returns: Extension version.
    :rtype: dict
    """
    app.add_config_value('disqus_shortname', None, True)
    app.add_directive('disqus', DisqusDirective)
    app.add_node(DisqusNode, html=(DisqusNode.visit, DisqusNode.depart))
    app.config.html_static_path.append(os.path.relpath(STATIC_DIR, app.confdir))
    app.connect('html-page-context', event_html_page_context)
    return dict(version=__version__)