Just a few more pages… ckanext-pages
Organization is key. Neat and tidy, yet user-friendly — this is the way we would describe the ckanext-pages. Most of the time the default setting of the pages on the CKAN data portals aren’t satisfying every client’s needs. So, why not start with enabling ckanext-pages?
Easy and handy when the need for customisation appears. It is an extension that allows adding additional pages on the CKAN data portals, besides the default one. Additionally this extension allows sharing blog articles on the Data portal.
How does ckanext-pages work?
New pages or blog articles can be created only by the system administrators.
Their visibility can be configured as public (visible for all Data portal users: registered and non-registered) and private (visible only for the system administrators).
Creating new pages goes through a simple way, by clicking the “+ADD PAGE” button. A form for creating new pages will be opened, where the system administrator can add the following information for the particular page:
- Title — a descriptive title of the new page
- Publish Date — calendar with an option for adding the date of publishing the new page
- Visibility — private or public
- Menu order — order of the new page in the main navigation Data Portal menu (Datasets, Organizations, Groups…)
- Content — WYSIWYG text box for adding the content of the page
The Blog form contains the same fields as the pages form and usually, it is used for sharing news on the Data portals. The WYSIWYG text box allows adding images too, that makes the article more attractive to the final users. Same as the Pages, the blogs can be configured as private and public and also can be added as part of the main navigation menu of the portal.
Use pip to install this plugin. This example installs it in /home/www-data/pyenv, assuming you have setup a virtualenv there:
pip install -e 'git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages'
Make sure to add pages to ckan.plugins in your config file:
ckan.plugins = pages
Extra config options allow you to control the creation of extra pages against groups and organizations.
To switch on this behaviour, to your config add:
ckanext.pages.organization = True
ckanext.pages.group = True
These options are False by default.
This module also gives you a quick way to remove default elements from the CKAN menu and you may need to do this in order for you to have space for the new items you add. These options are:
ckanext.pages.about_menu = False
ckanext.pages.group_menu = False
ckanext.pages.organization_menu = False
By default these are all set to True, like on a default install.
To enable HTML output for the pages (along with Markdown), add the following to your config:
ckanext.pages.allow_html = True
By default this option is set to False. Note that this feature is only available for CKAN >= 2.3. For older versions of CKAN, this option has no effect. Use this option with care and only allow this if you trust the input of your users.
If you want to use the WYSIWYG editor instead of Markdown:
ckanext.pages.editor = medium
ckanext.pages.editor = ckeditor
If you would like to know more or contribute to ckanext-pages visit the official github repository.
Customize your data portals with ckanext-pages, allow clients and users to get creative and engage more! Let us know of any blogs that you might share using this extension and write your review in the comments, we’d love to hear it!
Author: Petar Efnushev, Software Engineer at Keitaro
This article was originally published on keitaro.com