This extension provides a snippet in dataset page to cite a dataset in a specific citation style.
This extension is only tested in CKAN 2.9 and later.
To install ckanext-citation:
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
Install the ckanext-citation Python package into your virtual environment:
pip install 'git+https://github.com/depositar/ckanext-citation.git#egg=ckanext-citation'
Add
citation
to theckan.plugins
setting in your CKAN config file (by default the config file is located at/etc/ckan/default/ckan.ini
).Add a file
templates/package/read_base.html
in your custom extension (or modify/usr/lib/ckan/default/src/ckan/ckan/templates/package/read_base.html
if you are not using a custom extension):{% ckan_extends %} {% block secondary_content %} {{ super() }} {% snippet "citation/package/snippets/citation.html" %} {% endblock %}
Restart CKAN and Solr. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service jetty8 restart sudo service apache2 reload
Mapping between CKAN Fields and CSL Variables
Currently only title, author, and url fields are supported (the default value of url will be the url of current page).
ckanext.citation.csl_mappings = {"title": "title", "author": "author"}
It also maps the name part of the ark
CKAN field from the
ckanext-ark extension
to the last part of citation-key
CSL variable.
For example the following ark
CKAN field:
ark:99999/k2abdfg6
Will be converted to the following citation-key
CSL variable:
author_year_k2abdfg6
citation
build_styles
: generate a list of citation styles.:ckan -c CONFIG citation build_styles
By default, the following styles will be shown as major styles:
- apa
- modern-language-association
- chicago-note-bibliography
- chicago-author-date
- ieee
- council-of-science-editors
- american-medical-association
- american-chemical-society
- american-institute-of-physics
- american-society-of-civil-engineers
You may need to update the citation styles:
cd /usr/lib/ckan/default/src/ckanext-citation/ckanext/citation/public/ckanext/citation/csl/styles && git pull