-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to modify the front-end template in ckan-docker? #155
Comments
Hi Marco, to customize the front-end template in CKAN using the ckan-docker setup, the best approach is to create a CKAN extension where you can override templates, add custom styles, and implement any additional frontend logic you need. Here are the basic steps for developing a custom theme in CKAN:
Cheers! |
Hi, I tried to add a custom plugin from a git repository. I followed all your instructions, but the result is always the same. My plugin doesn't override the scheming template, and my team and I can't figure out why. Could you help us out? We have verified that the custom plugin is correctly loaded inside the ckan_dev container in the src_extensions folder, but the template located in /srv/app/src/ckan/ckan/templates is still the one from scheming. |
I try to help you, Here’s how you can adjust your setup:
In your ckan.ini, ensure that scheming is not explicitly listed in the ckan.plugins section. You’ll only load your custom plugin that inherits from scheming. Example: ckan.plugins = your_custom_plugin
from ckanext.scheming.plugins import SchemingDatasetsPlugin
import ckan.plugins as plugins
class CustomSchemingPlugin(SchemingDatasetsPlugin):
plugins.implements(plugins.IConfigurer)
plugins.implements(plugins.IConfigurable)
plugins.implements(plugins.ITemplateHelpers)
plugins.implements(plugins.IDatasetForm, inherit=True)
plugins.implements(plugins.IActions)
plugins.implements(plugins.IValidators)
def read_template(self):
# Override the default read template
return "your_custom_plugin/package/read.html"
def resource_template(self):
# Override the default resource template
return "your_custom_plugin/package/resource_read.html"
def package_form(self):
return "your_custom_plugin/package/snippets/package_form.html"
def resource_form(self):
return "your_custom_plugin/package/snippets/resource_form.html" This approach ensures that CKAN will use your custom templates (
def update_config(self, config):
# Add the custom templates directory to CKAN's search path
plugins.toolkit.add_template_directory(config, 'templates') If you run into any more issues, feel free to reach out. |
Hello @mjanez,
I'm currently working with the ckan-docker setup and would like to customize the front-end template. Could you please guide me on how to proceed with modifying the template? Any help or pointers would be greatly appreciated.
Thank you for your time and assistance!
Best regards,
Marco
The text was updated successfully, but these errors were encountered: