Skip to main content

Tests

ckanext-likes

A CKAN extension that enables users to like any object with a unique ID, promoting engagement across datasets, resources, organizations, and more.

Overview

This CKAN extension introduces a flexible and reusable "like" functionality that can be attached to any CKAN object with a unique identifier. Whether it's datasets, resources, organizations, groups, or custom entities introduced by other extensions, this plugin allows users to express appreciation or endorse content directly within the CKAN interface.

Key features include:

  • Universal Compatibility: Works with any CKAN object that has a unique ID, including datasets, resources, organizations, users, or even custom content types.

  • ful API Support: Exposes endpoints to like/unlike objects and retrieve like counts, enabling integration with third-party systems or frontend customizations.

  • Customizable UI Widgets: Provides simple templates and frontend snippets that can be embedded anywhere in CKAN themes to display like buttons and counters.

  • User Tracking & Anti-Spam: Ties likes to user accounts to prevent duplicate voting and support analytics.

This extension can be a powerful tool to highlight popular datasets, promote community curation, and enhance overall user interaction on your CKAN portal.

Installation

Compatibility with core CKAN versions:

CKAN version Compatible?
<= 2.10 No
>= 2.11 Yes

Install the extension from PyPI:

pip install ckanext-likes

Add likes to the list of CKAN plugins and apply database migrations:

ckan db upgrade -p likes

Usage

Add like-widget on any page and it will automatically initialize and update likes for the specified object:

{%
    snippet "likes/snippets/widget.html",
    object_id=OBJECT_ID, object_type=OBJECT_TYPE, inline=true
%}

inline flag renders widget with 0 likes. When the widget appears in the viewport for the first time, it updates the value via AJAX request and listens for the user clicks, handling like/un-like events and re-rendering icon and counter.

If you want to update counters as soon as page loads, add inline_trigger="load" argument to the snippet call. This is not recommended if you have a lot of widgets on the page, such as like-buttons agains every comment in the comments thread.

{%
    snippet "likes/snippets/widget.html",
    object_id=OBJECT_ID, object_type=OBJECT_TYPE, inline=true, inline_trigger="load"
%}

If you already know the number of likes for the object and whether current visitor has already liked the object, specify these parameters as count and liked arguments for the snippet, instead of the inline=true. In this case, widget won't perform additional requests to the backend during initialization:

{%
    snippet "likes/snippets/widget.html",
    object_id=OBJECT_ID, object_type=OBJECT_TYPE, count=100, liked=true
%}

Release files for ckanext-likes 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ckanext-likes 0.0.1
File Size Uploaded
ckanext_likes-0.0.1.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ckanext-likes 0.0.1
File Interpreter ABI Platform
ckanext_likes-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.5 kB

Release files / ckanext_likes-0.0.1.tar.gz

Download URL ckanext_likes-0.0.1.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
27fb98336692b98ac9de4496c78a821308b7ec188bd959dad7cb8b8da781fab4
BLAKE2b-256 checksum
How to use checksums
479d42f64f2955c2d182cc832dd8d29b66d35bb03b2ee8b609903c9945064aee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release files / ckanext_likes-0.0.1-py3-none-any.whl

Download URL ckanext_likes-0.0.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bc190e5d5cb89bb01aa260af2f021495887daf3d4a5eb966fffcd61f27cb739
BLAKE2b-256 checksum
How to use checksums
7160f570a97da934459e299735015c0fb3480d53a375b5b2c2bafe16c1a91dfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page