<html xmlns:py="http://genshi.edgewall.org/"
  xmlns:i18n="http://genshi.edgewall.org/i18n"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  py:strip="">

  <py:def function="page_title">Home</py:def>

  <py:def function="optional_head">
  <script src="${g.site_url}/scripts/jquery.tagcloud.js"></script>
  <script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
      $.fn.tagcloud.defaults = {
        size: {start: 10, end: 32, unit: "pt"}, 
        color: {start: '#af8', end: '#f52'}
      };
      $("#tagcloud a").tagcloud();
    })
  </script>
  <style type="text/css">
    #tagcloud * {
      display: inline-block;
      vertical-align: middle;
      line-height: 0.9;
    }

    #tagcloud a {
      text-decoration: none;
    }

    #tagcloud a:hover {
      text-decoration: underline;
    }

    #tagcloud {
      margin: 25px auto;
      text-align: center;
    }
  </style>
  </py:def>

  <div py:match="content">
    <h2>Welcome to ${g.site_title}</h2>
    <p i18n:msg="title">
      ${g.site_title} is an
      <a href="http://www.opendefinition.org/ossd/">open registry</a>
      of data and content packages. Harnessing the CKAN software, this
      site makes it easy to find, share and reuse content and data,
      especially in ways that are machine automatable.
    </p>
    
    <p i18n:msg="package_count"><strong>${c.package_count} registered data packages</strong> available.</p>

    <xi:include href="../package/search_form.html" />
    
    <py:if test="len(c.facets.get('tags', {}))">
        <h4>Top Tags</h4>
        <div id="tagcloud">
        <py:for each="tag_name, count in c.facets.get('tags', {}).items()">
          <a rel="${count}" title="${count}" href="${h.url_for(controller='tag',
            action='read', id=tag_name)}">${tag_name}</a>
        </py:for>
        </div>
        <hr />
    </py:if>

    <h4>Recently changed packages</h4>
    ${package_list(c.latest_packages)}

    <p><a href="${h.url_for(controller='revision', action='index',
      id=None)}">View revision log &raquo;</a></p>
  </div>

  <xi:include href="layout.html" />
</html>
