Skip to content

CKAN Content

Content components are designed to display CKAN's core entities in a consistent way. Most entities have a singular component (e.g., package) and a list wrapper (e.g., package_list).

Datasets (Packages)

The package component displays information about a single dataset, typically as a snippet in search results or a list.

Example

{%- call ui.util.call(ui.package_list) -%}
    {%- for pkg in packages -%}
        {{ ui.package(package=pkg) }}
    {%- endfor -%}
{%- endcall -%}
Parameters for package_list
Parameter Type Description
content any Collection of packages
Parameters for package
Parameter Type Description
content any Usually ignored
package dict Dictionary with package details

Organizations

Displays information about a CKAN organization.

Example

{%- call ui.util.call(ui.organization_list) -%}
    {%- for org in organizations -%}
        {{ ui.organization(organization=org) }}
    {%- endfor -%}
{%- endcall -%}
Parameters for organization_list
Parameter Type Description
content any Collection of organizations
Parameters for organization
Parameter Type Description
content any Usually ignored
organization dict Dictionary with organization details

Groups

Displays information about a CKAN group.

Example

{%- call ui.util.call(ui.group_list) -%}
    {%- for group in groups -%}
        {{ ui.group(group=group) }}
    {%- endfor -%}
{%- endcall -%}
Parameters for group_list
Parameter Type Description
content any Collection of groups
Parameters for group
Parameter Type Description
content any Usually ignored
group dict Dictionary with group details

Resources

Displays information about a single resource within a dataset.

Example

{%- call ui.util.call(ui.resource_list) -%}
    {%- for resource in resources -%}
        {% set package = h.get_package(resource.package_id) %}
        {{ ui.resource(resource=resource, package=package) }}
    {%- endfor -%}
{%- endcall -%}
Parameters for resource_list
Parameter Type Description
content any Collection of resources
Parameters for resource
Parameter Type Description
content any Usually ignored
resource dict Dictionary with resource details
package dict Dictionary with parent package details

Users

Displays user profile information.

Example

{%- call ui.util.call(ui.user_list) -%}
    {%- for user in users -%}
        {{ ui.user(user=user) }}
    {%- endfor -%}
{%- endcall -%}
Parameters for user_list
Parameter Type Description
content any Collection of users
Parameters for user
Parameter Type Description
content any Usually ignored
user dict Dictionary with user details

Search & Facets

Components for filtering and exploring content.

Facets

facet components are used to filter search results. They are usually grouped into a facet_list and further organized into facet_sections.

Example

{%- call ui.util.call(ui.facet_section, title=_("Organizations")) -%}
    {%- call ui.util.call(ui.facet_list) -%}
        {%- for item in facets -%}
            {{ ui.facet(item.display_name, key="organization", value=item.name, count=item.count) }}
        {%- endfor -%}
    {%- endcall -%}
{%- endcall -%}

Facet section

Parameters for facet_section
Parameter Type Description
content any List of facets
title str Optional title of the facet section
key str Facet key ("organization", "res_format", etc.)
has_more bool Whether there are more facet values that can be shown in a "show more" widget.

Facet list and facet

Parameters for facet_list
Parameter Type Description
content any Collection of search facets
Parameters for facet
Parameter Type Description
content any Label of the facet item
key str Facet key ("organization", "res_format", etc.)
value str Facet value (organization name, resource format, etc.)
count int Number of items matching this facet value.
active bool Whether this facet value is currently active.

Filters Container

A high-level container for all search filters, typically shown in the sidebar.

Example

{%- call ui.util.call(ui.filters) -%}
    {%- call ui.util.call(ui.facet_section, title=_("Organizations")) -%}
        {%- call ui.util.call(ui.facet_list) -%}
            {%- for item in facets -%}
                {{ ui.facet(item.display_name, key="organization", value=item.name, count=item.count) }}
            {%- endfor -%}
        {%- endcall -%}
    {%- endcall -%}

    {%- call ui.util.call(ui.facet_section, title=_("Tags")) -%}
        {%- call ui.util.call(ui.facet_list) -%}
            {%- for item in tag_facets -%}
                {{ ui.facet(item.display_name, key="tags", value=item.name, count=item.count) }}
            {%- endfor -%}
        {%- endcall -%}
{%- endcall -%}
Parameters for filters
Parameter Type Description
content any Collection of facet sections